From 798b279956483629668863aa96504cfd00c30fe0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Juri=C5=A1i=C4=87?= Date: Thu, 8 Jan 2026 15:37:49 +0100 Subject: [PATCH] Fixed occ script, postinstall permissions and Updated rules and readme --- README.md | 4 ++-- debian/changelog | 7 +++++++ debian/nextcloud-server.postinst | 27 +++++++++++++++++++-------- debian/rules | 23 ++++------------------- debian/usr/sbin/occ | 2 +- 5 files changed, 33 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 43daff8..ff7f320 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ git checkout trixie uscan --verbose --download-current-version cd ../nextcloud-server-32.0.3 dch -n -dpkg-buildpackage -rfakeroot -us -uc +dpkg-buildpackage -us -uc cd .. -dpkg -i nextcloud-server_32.0.3-1~deb13_all.deb +dpkg -i nextcloud-server_32.0.3-2~deb13_all.deb ``` diff --git a/debian/changelog b/debian/changelog index dd28a97..9a9a904 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +nextcloud-server (32.0.3-2~deb13) trixie; urgency=medium + + * Fixed occ script, postinstall permissions + * Updated rules, readme + + -- Ivan Jurišić Tue, 08 Jan 2026 15:34:32 +0200 + nextcloud-server (32.0.3-1~deb13) trixie; urgency=medium * New upstream release 32.0.3 diff --git a/debian/nextcloud-server.postinst b/debian/nextcloud-server.postinst index 0bc309b..f1973de 100644 --- a/debian/nextcloud-server.postinst +++ b/debian/nextcloud-server.postinst @@ -38,18 +38,29 @@ configure) apache2_invoke enmod mime || exit $? fi - if [ "$(su 'www-data' -s /bin/sh -c 'php /var/www/nextcloud/occ status' | grep 'installed:' | cut -f2 -d ':' | xargs)" = "false" ]; then + # Permissions and owners + chown www-data:www-data /var/www/nextcloud/apps + chown www-data:www-data /var/www/nextcloud/config + chown www-data:www-data /var/www/nextcloud/data + chown www-data:www-data /var/www/nextcloud/themes + chown www-data:www-data /var/www/nextcloud/updater + chown www-data:www-data /var/www/nextcloud/occ + chmod 0644 /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 su 'www-data' -s /bin/sh -c 'php /var/www/nextcloud/occ config:system:set --value true upgrade.disable-web'" - elif [ "$(su 'www-data' -s /bin/sh -c 'php /var/www/nextcloud/occ status' | grep 'installed:' | cut -f2 -d ':' | xargs)" = "true" ]; then - su 'www-data' -s /bin/sh -c 'php /var/www/nextcloud/occ maintenance:update:htaccess' - su 'www-data' -s /bin/sh -c 'php /var/www/nextcloud/occ upgrade' - su 'www-data' -s /bin/sh -c 'php /var/www/nextcloud/occ db:add-missing-indices' - su 'www-data' -s /bin/sh -c 'php /var/www/nextcloud/occ config:system:set --value true upgrade.disable-web' >/dev/null || true + 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) ;; diff --git a/debian/rules b/debian/rules index 2ab99c8..dea655f 100755 --- a/debian/rules +++ b/debian/rules @@ -9,23 +9,8 @@ override_dh_strip_nondeterminism: override_dh_fixperms: dh_fixperms - mkdir -p debian/nextcloud-server/var/www/nextcloud/data - mkdir -p debian/nextcloud-server/var/www/nextcloud/updater + mkdir -p debian/nextcloud-server/var/www/nextcloud/data + mkdir -p debian/nextcloud-server/var/www/nextcloud/updater - find debian/nextcloud-server/var/www/nextcloud -type f -print0 | xargs -0 chmod 0640 - find debian/nextcloud-server/var/www/nextcloud -type d -print0 | xargs -0 chmod 0750 - - chown -R www-data:www-data debian/nextcloud-server/var/www/nextcloud - chown -R www-data:www-data debian/nextcloud-server/var/www/nextcloud/apps - chown -R www-data:www-data debian/nextcloud-server/var/www/nextcloud/config - chown -R www-data:www-data debian/nextcloud-server/var/www/nextcloud/data - chown -R www-data:www-data debian/nextcloud-server/var/www/nextcloud/themes - chown -R www-data:www-data debian/nextcloud-server/var/www/nextcloud/updater - - chmod 0644 debian/nextcloud-server/var/www/nextcloud/.htaccess - chown www-data:www-data debian/nextcloud-server/var/www/nextcloud/.htaccess - - chmod +x debian/nextcloud-server/var/www/nextcloud/occ - chmod +x debian/usr/sbin/occ - - + find debian/nextcloud-server/var/www/nextcloud -type f -print0 | xargs -0 chmod 0640 + find debian/nextcloud-server/var/www/nextcloud -type d -print0 | xargs -0 chmod 0750 diff --git a/debian/usr/sbin/occ b/debian/usr/sbin/occ index 4f641c7..5bae4d2 100755 --- a/debian/usr/sbin/occ +++ b/debian/usr/sbin/occ @@ -2,7 +2,7 @@ if [ $(id -u) -eq 0 ] || [ $(id -u) -eq 33 ];then OPT="$@" - su www-data -s /bin/sh -c "/usr/bin/php /var/www/nextcloud/occ $OPT" + su -g www-data -s /bin/sh -c "/var/www/nextcloud/occ $OPT" else echo "Please run as root" fi