Keep .htaccess on updates #29

Closed
opened 2024-07-24 21:12:50 +02:00 by citronalco · 4 comments
Contributor

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 :)
citronalco changed title from .htaccess is in the way on package updates to Keep .htacces on updates 2024-07-24 21:13:22 +02:00
citronalco changed title from Keep .htacces on updates to Keep .htaccess on updates 2024-07-24 21:13:28 +02:00
Owner

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.
Author
Contributor

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.
Owner

Thanks for suggestion, I apply commit e0a0d1f61b

Thanks for suggestion, I apply commit e0a0d1f61b
Author
Contributor

Thank you!

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

No dependencies set.

Reference: ijurisic/nextcloud-deb#29
No description provided.