FS#1074 - package upgrades removes files if they don't exist in the new package, regardless of rejection rules
pkgadd -u removes files if they don't exist in the new package, regardless of the rejection rules in pkgadd.conf.
As a test I create package for app-1.0 with /etc/app.conf, and then app-2.0 without it:
[root@koji ~]# mkdir etc
[root@koji ~]# echo default configuration > etc/app.conf
[root@koji ~]# tar -czf app#1.0-1.pkg.tar.gz etc
[root@koji ~]# rm etc/app.conf
[root@koji ~]# tar -czf app#2.0-1.pkg.tar.gz etc
I will install app-1.0, and then customize my configuration file:
[root@koji ~]# pkgadd app#1.0-1.pkg.tar.gz
[root@koji tmp]# cat /etc/app.conf
default configuration
[root@koji tmp]# echo customized configuration > /etc/app.conf
Now I will upgrade to app-2.0, and my custom configuration file will be gone:
[root@koji tmp]# pkgadd -u app#2.0-1.pkg.tar.gz
[root@koji tmp]# ls -l /etc/app.conf
ls: cannot access /etc/app.conf: No such file or directory
My pkgadd.conf contains:
UPGRADE ^etc/.*$ NO
Loading...
Available keyboard shortcuts
- Alt + ⇧ Shift + l Login Dialog / Logout
- Alt + ⇧ Shift + a Add new task
- Alt + ⇧ Shift + m My searches
- Alt + ⇧ Shift + t focus taskid search
Tasklist
- o open selected task
- j move cursor down
- k move cursor up
Task Details
- n Next task
- p Previous task
- Alt + ⇧ Shift + e ↵ Enter Edit this task
- Alt + ⇧ Shift + w watch task
- Alt + ⇧ Shift + y Close Task
Task Editing
- Alt + ⇧ Shift + s save task
Attached a patch that seems to fix this, with a drawback.
Re-adding patch
Attached is a patch that changes the function signature of db_rm_pkg to prevent the unwanted deletions. I've tested it on a trivial upgrade of mpv (first package built with --sysconfdir=/etc, the later release built with --sysconfdir=/usr/etc, and the directive "UPGRADE ^etc/.*$ NO" in pkgadd.conf). The updated rejmerge (included with the patch) provides an interactive menu for deciding what to do with the stale files.