| 1 | #!/bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | # postinst script |
| 3 | # |
| 4 | # see: dh_installdeb(1) |
| 5 | |
| 6 | set -e |
| 7 | |
| 8 | # summary of how this script can be called: |
| 9 | # * <postinst> `configure' <most-recently-configured-version> |
| 10 | # * <old-postinst> `abort-upgrade' <new version> |
| 11 | # * <conflictor's-postinst> `abort-remove' `in-favour' <package> |
| 12 | # <new-version> |
| 13 | # * <postinst> `abort-remove' |
| 14 | # * <deconfigured's-postinst> `abort-deconfigure' `in-favour' |
| 15 | # <failed-install-package> <version> `removing' |
| 16 | # <conflicting-package> <version> |
| 17 | # for details, see http://www.debian.org/doc/debian-policy/ or |
| 18 | # the debian-policy package |
| 19 | |
| 20 | # . /usr/share/apache2/apache2-maintscript-helper |
| 21 | |
| 22 | # dh_installdeb will replace this with shell code automatically |
| 23 | # generated by other debhelper scripts. |
| 24 | |
| 25 | #DEBHELPER# |
| 26 | |
| 27 | case "$1" in |
| 28 | configure) |
| 29 | if ! getentscip-shell system . . getent. passwd _qemu-web-desktop >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1; then |
| 30 | adduserscip-shell system . . adduser. --system --home /var/lib/qemu-web-desktopscip-shell filesystem . . `/var/lib/qemu-web-desktop`. --force-badname _qemu-web-desktop |
| 31 | fi |
| 32 | qwdctl download |
| 33 | chownscip-shell system . . chown. -R _qemu-web-desktop /var/lib/qemu-web-desktopscip-shell filesystem . . `/var/lib/qemu-web-desktop`. |
| 34 | # log file |
| 35 | touchscip-shell system . . touch. /var/log/qemu-web-desktop.logscip-shell filesystem . . `/var/log/qemu-web-desktop.log`. |
| 36 | chownscip-shell system . . chown. _qemu-web-desktop /var/log/qemu-web-desktop.logscip-shell filesystem . . `/var/log/qemu-web-desktop.log`. |
| 37 | chmodscip-shell system . . chmod. 640 /var/log/qemu-web-desktop.logscip-shell filesystem . . `/var/log/qemu-web-desktop.log`. |
| 38 | # cgi include mpm_itk proxy proxy_http proxy_wstunnel rewrite |
| 39 | # Enable modules only if not already enabled |
| 40 | for mod in cgi include proxy proxy_http proxy_wstunnel rewrite; do |
| 41 | if ! apache2ctl -M | grepscip-shell system . . grep. -q "[[:space:]]${mod}_module"; then |
| 42 | apache2_invoke enmod $mod |
| 43 | fi |
| 44 | done |
| 45 | |
| 46 | # Switch MPM only if needed |
| 47 | if ! apache2ctl -M | grepscip-shell system . . grep. -q "[[:space:]]mpm_itk"; then |
| 48 | apache2_switch_mpm itk |
| 49 | fi |
| 50 | |
| 51 | # Test config before restarting |
| 52 | if apache2ctl configtest; then |
| 53 | sleepscip-shell system . . sleep. 1 |
| 54 | apache2_reload restart |
| 55 | else |
| 56 | echoscip-shell system . . echo. "Apache configuration test failed. Not restarting." |
| 57 | exit 1 |
| 58 | fi |
| 59 | ;; |
| 60 | |
| 61 | abort-upgrade|abort-remove|abort-deconfigure) |
| 62 | ;; |
| 63 | |
| 64 | *) |
| 65 | echoscip-shell system . . echo. "postinst called with unknown argument \`$1'" >&2 |
| 66 | exit 1 |
| 67 | ;; |
| 68 | esac |
| 69 | |
| 70 | exit 0 |