You are not logged in.

#1 2024-08-02 22:31:24

JesseSteele
Member
From: Pacifica
Registered: 2022-07-08
Posts: 11
Website

PKGBUILD backup=() files removed on uninstall [SOLVED]

I've ready through the Arch PKGBUILD wiki ad nausium, and nothing works.

Everything installs correctly, the service works, everything runs...

But, then when I uninstall with `sudo pacman -R myapp`, the `/etc/myapp/conf` file and directory still get deleted! I want to keep that `/etc/` config unless I use `sudo pacman -Rsn myapp`. What am I doing wrong?

Here is my PKGBUILD:

pkgname=myapp
pkgver=1.0.0
pkgrel=1
pkgdesc="world's most amazing app"
arch=('any')
license=('GPL')
depends=('systemd')
source=("$pkgname.sh" "$pkgname.service" "conf")
sha256sums=('SKIP' 'SKIP' 'SKIP')
backup=('etc/myapp/conf')

package() {

  install -Dm755 "$srcdir/$pkgname.sh" "$pkgdir/usr/lib/$pkgname/$pkgname.sh"
  install -Dm644 "$srcdir/$pkgname.service" "$pkgdir/usr/lib/systemd/system/$pkgname.service"
  install -Dm644 "$srcdir/conf" "$pkgdir/etc/$pkgname/conf"
  
}

Included files that work (FYR)

├─ PKGBUILD
├─ conf
├─ myapp.service
└─ myapp.sh

Last edited by JesseSteele (2024-08-05 00:42:04)

Offline

#2 2024-08-02 22:42:55

loqs
Member
Registered: 2014-03-06
Posts: 18,730

Re: PKGBUILD backup=() files removed on uninstall [SOLVED]

Pacnew_and_Pacsave#.pacsave Was the removed backup file modified from the one that was installed by pacman?

Offline

#3 2024-08-02 22:50:39

JesseSteele
Member
From: Pacifica
Registered: 2022-07-08
Posts: 11
Website

Re: PKGBUILD backup=() files removed on uninstall [SOLVED]

Both of these return nothing of that file:

# find /etc -name '*.pacnew' -o -name '*.pacsave'
$ grep '\.pacnew\|\.pacsave' /var/log/pacman.log

Even beyond that, I want the file and directory `/etc/myapp/conf` to remain in place, right where it is. Can that be done when installing with `makepkg`?

Offline

#4 2024-08-02 23:02:18

loqs
Member
Registered: 2014-03-06
Posts: 18,730

Re: PKGBUILD backup=() files removed on uninstall [SOLVED]

Yes it can be achieved by not having `/etc/myapp/conf` be part of the package but installed by the .install script or an alpm-hook.  This would not be following Arch package guidelines though which is only to preserve modified config files.

Last edited by loqs (2024-08-02 23:02:38)

Offline

#5 2024-08-02 23:17:34

JesseSteele
Member
From: Pacifica
Registered: 2022-07-08
Posts: 11
Website

Re: PKGBUILD backup=() files removed on uninstall [SOLVED]

If preserving the config file in `/etc/` can only be done against guidelines, should I make a feature request?

Offline

#6 2024-08-02 23:36:11

loqs
Member
Registered: 2014-03-06
Posts: 18,730

Re: PKGBUILD backup=() files removed on uninstall [SOLVED]

What is the use case for the unmodified config file after package removal? You could make a feature request to the pacman project to support it. You could submit an idea covering the change in the handling config files you want to see.

Offline

#7 2024-08-03 03:48:12

Scimmia
Fellow
Registered: 2012-09-01
Posts: 13,365

Re: PKGBUILD backup=() files removed on uninstall [SOLVED]

JesseSteele wrote:

If preserving the config file in `/etc/` can only be done against guidelines, should I make a feature request?

A feature request for something totally useless will just be ignored. If you modify the file, it already gets saved. If it's not modified, there is no point in saving it.

Offline

#8 2024-08-03 06:22:06

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 71,651

Re: PKGBUILD backup=() files removed on uninstall [SOLVED]

I want to keep that `/etc/` config

https://en.wikipedia.org/wiki/XY_problem
Why do you think you want to preserve a default file? What's the actual problem/task/goal?

Online

#9 2024-08-05 00:40:17

JesseSteele
Member
From: Pacifica
Registered: 2022-07-08
Posts: 11
Website

Re: PKGBUILD backup=() files removed on uninstall [SOLVED]

Sorry all, I did not understand the description from the backup section. Files must be changed for the backup array to have any effect. I added a brief clarification to prevent such a misunderstanding, also addressing directories. Thanks, my question is answered.

Last edited by JesseSteele (2024-08-05 00:45:00)

Offline

Board footer

Powered by FluxBB