#! /bin/sh # postinst script for wims # # see: dh_installdeb(1) set -e [ -e /usr/share/debconf/confmodule ] && . /usr/share/debconf/confmodule # summary of how this script can be called: # * `configure' # * `abort-upgrade' # * `abort-remove' `in-favour' # # * `abort-deconfigure' `in-favour' # `removing' # # for details, see http://www.debian.org/doc/debian-policy/ or # the debian-policy package # read_only_dirs(){ adm=/var/lib/wims/public_html/modules/adm dirs="$(ls -d $adm/doc $adm/new $adm/sheet $adm/vote) /var/lib/wims/bin /var/lib/wims/log /var/lib/wims/log/account /var/lib/wims/log/classes /var/lib/wims/log/classes/1011/forum /var/lib/wims/log/classes/1011/forum/.threads /var/lib/wims/log/forums /var/lib/wims/log/modules /var/lib/wims/log/referer /var/lib/wims/public_html/bases/dic /var/lib/wims/public_html/bases/doc /var/lib/wims/public_html/bases/sheet /var/lib/wims/public_html/bases/site /var/lib/wims/public_html/bases/site/lists /var/lib/wims/public_html/bases/site/pop /var/lib/wims/public_html/bases/sys /var/lib/wims/public_html/bin /var/lib/wims/public_html/msg /var/lib/wims/public_html/scripts/adm /var/lib/wims/s2 /var/lib/wims/sessions /var/lib/wims/src /var/lib/wims/tmp/log" for d in $dirs; do mkdir -p $d dpkg-statoverride --list $d > /dev/null || \ dpkg-statoverride --update --add wims wims 700 $d # enforce the same if dpkg-statoverride did not that job chmod 700 $d done true } adjust_maildir(){ maildir="" if [ -f /etc/mailname ]; then maildir=$(cat /etc/mailname); fi for f in themes/default/visitor.phtml \ themes/default/supervisor.phtml \ themes/standard/visitor.phtml \ themes/standard/supervisor.phtml ; do source=/var/lib/wims/public_html/$f if [ -n "$maildir" ]; then sed 's/!mailurl \$wims_site_manager/!mailurl wims@'$maildir'/' $source.tpl > $source else cp $source.tpl $source fi done } msg_apache2_not_there="\ +========================================================+ | WIMS is not properly installed due to the missing | | apache2 package. Please install apache2, and reinstall | | wims after apache2's full configuration. | +========================================================+" msg_apache2_not_configured="\ +==========================================================+ | WIMS is not properly installed due to the apache2 | | package not yet configured. Apache2 should be configured | | shortly, so you just need to reinstall wims to achieve | | its full configuration. | +==========================================================+" case "$1" in configure) # add some utilities in the set of trusted wims applications: rm -f /var/lib/wims/bin/true; ln -s /bin/true /var/lib/wims/bin rm -f /var/lib/wims/bin/false; ln -s /bin/false /var/lib/wims/bin # giving all to wims user. That is a quick'n dirty hack ! # is it necessary ? chown -R wims:wims /var/lib/wims /usr/lib/wims/bin /usr/lib/wims/other # fixing permissions for some dirs read_only_dirs; # making wims suid, sgid if ! dpkg-statoverride --list /var/lib/wims/public_html/wims >/dev/null 2>&1 then dpkg-statoverride --update --add wims wims 6755 /var/lib/wims/public_html/wims 2>/dev/null fi # apply a fix (thanks to dmanye@urv.cat for the hint, which solves bug #817963 for f in /var/lib/wims/sessions /var/lib/wims/s2; do if ! dpkg-statoverride --list $f >/dev/null 2>&1 then dpkg-statoverride --update --add wims wims 755 $f 2>/dev/null fi done #making /usr/lib/wims/bin private if ! dpkg-statoverride --list /usr/lib/wims/bin >/dev/null 2>&1 then dpkg-statoverride --update --add wims wims 700 /usr/lib/wims/bin 2>/dev/null fi #making wims.conf private conffile=/var/lib/wims/log/wims.conf [ -f $conffile ] || cp -f $conffile.distrib $conffile if ! dpkg-statoverride --list $conffile >/dev/null 2>&1 then dpkg-statoverride --update --add wims wims 600 $conffile 2>/dev/null fi # linking to /etc/wims [ -e /etc/wims/wims.conf ] || \ [ -e $(readlink /etc/wims/wims.conf) ] || ln -s $conffile /etc/wims # downgrading permissions for some wrappers lambdawrapper=/var/lib/wims/public_html/bin/wrap..exec dpkg-statoverride --update --force --add nowims nowims 6755 $lambdawrapper 2>/dev/null rm -f /var/lib/wims/log/unsecure # gives the write permission for wims over its config files chown -R wims:root /etc/wims # enable the cgi module and wims configuration # then reload apache2 if [ -e /usr/share/apache2/apache2-maintscript-helper ]; then if dpkg -l apache2 | grep -q ^ii; then . /usr/share/apache2/apache2-maintscript-helper apache2_invoke enmod cgi apache2_invoke enconf wims service apache2 reload || true else echo $msg_apache2_not_configured fi else echo $msg_apache2_not_there fi # modify the configuration for povray if this package is present if [ -f /etc/povray/3.6/povray.conf ]; then if ! grep -q wims /etc/povray/3.6/povray.conf; then echo 'read+write* = /var/lib/wims/tmp' >> \ /etc/povray/3.6/povray.conf fi fi # take in account the file /etc/mailname adjust_maildir # fix the link to the copyright file ln -sf /usr/share/doc/wims/copyright /var/lib/wims/public_html/COPYING # create some CSS stuff cd /var/lib/wims/public_html/themes && ./mkcss.pl # adjust ownship for some more directories chown -R wims:wims /var/lib/wims/public_html/modules \ /var/lib/wims/public_html/scripts \ /var/lib/wims/public_html/gifs chown -R wims:wims /var/lib/wims/tmp chown -R wims:wims /var/lib/wims/public_html/bases chown -R wims:wims /var/lib/wims/public_html/scripts for d in qpuzzle spuzzle; do puzzledir=/var/lib/wims/public_html/scripts/data/$d [ ! -d $puzzledir ] || chown -R wims:wims $puzzledir done chown -R wims:wims /var/lib/wims/public_html/bases # reindex all modules and other useful data echo "Reindexing Wims modules, classes and miscellanea in the background" echo "To watch the progress, see /var/lib/wims/nohup.out" (cd /var/lib/wims; rm -f nohup.out; su wims -s /bin/sh -c "nice ionice -c3 nohup bin/mkindex 2>&1" &) ;; abort-upgrade|abort-remove|abort-deconfigure) ;; *) echo "postinst called with unknown argument \`$1'" >&2 exit 1 ;; esac # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts. # Automatically added by dh_apache2/UNDECLARED if true; then if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then . /usr/share/apache2/apache2-maintscript-helper for conf in wims ; do apache2_invoke enconf $conf || exit 1 done fi fi # End automatically added section # Automatically added by dh_installdeb/13.14.1 dpkg-maintscript-helper symlink_to_dir /var/lib/wims/public_html/scripts/js/edit_area /usr/share/javascript/edit-area 4.13c\~dfsg1-2 -- "$@" # End automatically added section exit 0