#!/bin/sh # postinst script for nextcloud-server # # see: dh_installdeb(1) set -e # summary of how this script can be called: # * `configure' # * `abort-upgrade' # * `abort-remove' `in-favour' # # * `abort-remove' # * `abort-deconfigure' `in-favour' # `removing' # # for details, see https://www.debian.org/doc/debian-policy/ or # the debian-policy package export APACHE2_MAINTSCRIPT_HELPER_QUIET=1 case "$1" in configure) # Apache conf if [ "a2query -c nextcloud"=~"No conf matches nextcloud" ]; then a2enconf nextcloud || true apache2ctl restart || true fi # Apache modules if [ -e /usr/share/apache2/apache2-maintscript-helper ]; then . /usr/share/apache2/apache2-maintscript-helper apache2_invoke enmod rewrite || exit $? apache2_invoke enmod headers || exit $? apache2_invoke enmod env || exit $? apache2_invoke enmod dir || exit $? apache2_invoke enmod mime || exit $? fi # Permissions and owners chown -R www-data:www-data /var/www/nextcloud chmod 644 /var/www/nextcloud/.htaccess chmod +x /var/www/nextcloud/occ chmod +x /usr/sbin/occ # Check status if [ "$(/usr/sbin/occ status | grep 'installed:' | cut -f2 -d ':' | xargs)" = "false" ]; then echo "Nextcloud is not configured, please use open web browser http:///nextcloud" echo "After configure please run occ config:system:set --value true upgrade.disable-web'" elif [ "$(/usr/sbin/occ status | grep 'installed:' | cut -f2 -d ':' | xargs)" = "true" ]; then /usr/sbin/occ maintenance:update:htaccess /usr/sbin/occ upgrade /usr/sbin/occ db:add-missing-indices /usr/sbin/occ config:system:set --value true upgrade.disable-web >/dev/null || true else echo "Got unexpect answer, occ status can't to read satus of nextcloud. Check php installation." fi ;; 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. #DEBHELPER# exit 0