#!/bin/sh
#echo "postinst"
#set -e 

sed -i 's/Limit CUPS-Authenticate-Job/Limit Cancel-Job CUPS-Authenticate-Job/g' /etc/cups/cupsd.conf

sed -i '/Limit Cancel-Job CUPS-Authenticate-Job/!b;n;c Allow Everyone' /etc/cups/cupsd.conf

ln -s /opt/toec/OEP33SER/bin/libtjgd1zcommon.so.1.0.0 /opt/toec/OEP33SER/bin/libtjgd1zcommon.so
ln -s /opt/toec/OEP33SER/bin/libtjgd1zcommon.so.1.0.0 /opt/toec/OEP33SER/bin/libtjgd1zcommon.so.1
ln -s /opt/toec/OEP33SER/bin/libtjgd1zcommon.so.1.0.0 /opt/toec/OEP33SER/bin/libtjgd1zcommon.so.1.0

chmod 755 /opt/toec/OEP33SER/bin/libtjgd1zcommon.so /opt/toec/OEP33SER/bin/libtjgd1zcommon.so.1 /opt/toec/OEP33SER/bin/libtjgd1zcommon.so.1.0

ln -s /opt/toec/OEP33SER/bin/libtjgd1z.so.1.0.0 /opt/toec/OEP33SER/bin/libtjgd1z.so.1.0
ln -s /opt/toec/OEP33SER/bin/libtjgd1z.so.1.0.0 /opt/toec/OEP33SER/bin/libtjgd1z.so.1
ln -s /opt/toec/OEP33SER/bin/libtjgd1z.so.1.0.0 /opt/toec/OEP33SER/bin/libtjgd1z.so

chmod 755 /opt/toec/OEP33SER/bin/libtjgd1z.so.1.0 /opt/toec/OEP33SER/bin/libtjgd1z.so.1 /opt/toec/OEP33SER/bin/libtjgd1z.so
chmod 666 /opt/toec/OEP33SER/bin/fingerdata.db /opt/toec/OEP33SER/bin/setting.ini /opt/toec/OEP33SER/bin/job_history.xml
chmod 4755 /opt/toec/OEP33SER/bin/tjgd1zsm

chmod 755 /opt/toec/OEP33SER/bin/print_log_33ser
chown lp:lp /opt/toec/OEP33SER/bin/print_log_33ser

ln -s /opt/toec/OEP33SER/bin/tjgd1zpcl /usr/lib/cups/filter/toec_oep3300cdn
ln -s /opt/toec/OEP33SER/bin/tjgd2zpcl /usr/lib/cups/filter/toec_oep3310cdn

#chmod 777 /opt/toec/OEP33SER/bin/sm.conf /opt/toec/OEP33SER/bin/job_history.xml
#chown lp:lp /opt/toec/OEP33SER/bin/sm.conf /opt/toec/OEP33SER/bin/job_history.xml
#chcon -t cupsd_t /opt/toec/OEP33SER/bin/sm.conf /opt/toec/OEP33SER/bin/job_history.xml
######################
if [ -f "/etc/init.d/cups" ]
then
  /etc/init.d/cups restart 2>/dev/null
fi
if [ -f "/usr/bin/systemctl" ]
then
  /usr/bin/systemctl restart cups.service 2>/dev/null
fi

