Keep .htaccess on updates #29

Closed
opened 2024-07-24 21:12:50 +02:00 by citronalco · 4 comments
citronalco commented 2024-07-24 21:12:50 +02:00 (Migrated from git-old.jurisic.org)

When updating Nextcloud by installing a new nextcloud-server package, one gets asked whether to keep .htaccess or overwrite it. As far as I understand, the right answer is always "keep", and let Nextcloud update .htaccess afterwards with occ maintenance:update:htaccess

Currently you're listing .htaccess as "conffiles", but https://www.debian.org/doc/manuals/maint-guide/dother.en.html#conffiles says: "If your program uses configuration files but also rewrites them on its own, it's best not to make them conffiles because dpkg will then prompt users to verify the changes all the time."
Unfortunately it does not say how to prevent such files from getting overwritten on an update, otherwise you'd have another PR from me :)

When updating Nextcloud by installing a new nextcloud-server package, one gets asked whether to keep .htaccess or overwrite it. As far as I understand, the right answer is always "keep", and let Nextcloud update .htaccess afterwards with `occ maintenance:update:htaccess` Currently you're listing .htaccess as "conffiles", but https://www.debian.org/doc/manuals/maint-guide/dother.en.html#conffiles says: "If your program uses configuration files but also rewrites them on its own, it's best not to make them conffiles because dpkg will then prompt users to verify the changes all the time." Unfortunately it does not say how to prevent such files from getting overwritten on an update, otherwise you'd have another PR from me :)
ijurisic commented 2024-07-27 19:27:39 +02:00 (Migrated from git-old.jurisic.org)

If remove .htaccess from conffiles You will break lot Nextcloud installation because admin's adjust/change .htaccess.

If remove .htaccess from conffiles You will break lot Nextcloud installation because admin's adjust/change .htaccess.
citronalco commented 2024-07-29 19:26:27 +02:00 (Migrated from git-old.jurisic.org)

Since creating this incident, I've learnt that manual changes in .htaccess are not supported at all, and get deleted by Nextcloud's occ. See https://help.nextcloud.com/t/changes-to-htaccess-are-deleted-after-update/160884, and the linked issues.

I'd suggest dropping .htaccess from conffiles so that it gets always overwritten by the new version, and adding su 'www-data' -s /bin/sh -c 'php /var/www/nextcloud/occ maintenance:update:htaccess' to nextcloud-server.postinst to ensure that it is properly set up.

Since creating this incident, I've learnt that manual changes in .htaccess are not supported at all, and get deleted by Nextcloud's occ. See https://help.nextcloud.com/t/changes-to-htaccess-are-deleted-after-update/160884, and the linked issues. I'd suggest dropping .htaccess from conffiles so that it gets always overwritten by the new version, and adding `su 'www-data' -s /bin/sh -c 'php /var/www/nextcloud/occ maintenance:update:htaccess'` to nextcloud-server.postinst to ensure that it is properly set up.
ijurisic commented 2024-07-30 09:06:14 +02:00 (Migrated from git-old.jurisic.org)

Thanks for suggestion, I apply commit e0a0d1f61b

Thanks for suggestion, I apply commit e0a0d1f61b
citronalco commented 2024-07-30 21:56:57 +02:00 (Migrated from git-old.jurisic.org)

Thank you!

Thank you!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ijurisic/nextcloud-deb#29