#!/bin/sh set -e /bin/chown -R pykota.pykota /etc/pykota/ /bin/chmod 0640 /etc/pykota/pykota.conf /bin/chmod 0600 /etc/pykota/pykotadmin.conf /bin/chmod 0700 /usr/bin/cupspykota /bin/chmod 0700 /etc/default/printquota /bin/chmod 0755 /etc/cron.daily/pykota /bin/chmod 0755 /usr/lib/cgi-bin/printquota.cgi /bin/chmod 0755 /usr/lib/cgi-bin/dumpykota.cgi /bin/chmod 0755 /usr/lib/cgi-bin/pykotme.cgi /bin/chown www-data.www-data /usr/lib/cgi-bin/*cgi # modify apparmor APPARMOR_CUPS_FILE="/etc/apparmor.d/usr.sbin.cupsd" sed -i -e "/#LLIUREX_PYKOTA/,/#END_LLIUREX_PYKOTA/d" $APPARMOR_CUPS_FILE sed -i -e "s%\/usr\/sbin\/cupsd\ {%\/usr\/sbin\/cupsd\ \{\n\ \ \#LLIUREX_PYKOTA\n\\ \ \/usr\/share\/pykota\/cupspykota\ ixr\,\n\ \ \/etc\/pykota\/\*\ r\,\n\ \ \#END_LLIUREX_PYKOTA%g" $APPARMOR_CUPS_FILE mysql_root_passwd -i if [ $? -ne 0 ] ; then echo "Mysql is not working properly" exit 1 fi case $1 in install | configure) lliurex-sgbd --install pykota #create pykotaadmin passwd NEWPWD=$(grep \$dbpass debian-db.php | sed -e "s/\$dbpass='//g" | sed -e "s/';//g") sed -n 's/readwritepw/$NEWPWD/' /etc/pykota/pykotadmin.conf NEWUSERPW="`pwgen --capitalize --numerals 7 1`" sed -n 's/readonlypw/$NEWUSERPWD/' /etc/pykota/pykota.conf ;; upgrade) lliurex-sgbd --upgrade pykota ;; *) echo "[DEBUG] Unknow action ..." ;; esac service cups restart #DEBHELPER# exit 0