You are not logged in.

#1 2012-03-30 21:19:23

TiborB
Member
Registered: 2008-12-09
Posts: 103

[SOLVED] writing PKGBUILD-conf files not treated properly (no pacnew)

Hi

I am bit frustrated for I searched on web and failed to find answer, though I believe it must be trivial.

I am writing PKGBUILD, with one config file (in /etc/ of course). But when I reinstall the package, my (customized) config file is flatly overwritten (my changes lost), instead of creating *.pacnew file.

I looked at pacman manpage (mainly section Handling Config Files), PKGBUILD wiki (https://wiki.archlinux.org/index.php/PKGBUILD) but can not see what should I set. It seems to me that I have to say to pacman what files in my package are configuration files, if it is the case, how?

Please help...

Last edited by TiborB (2012-03-30 22:52:39)

Offline

#2 2012-03-30 21:26:17

bohoomil
Banned
Registered: 2010-09-04
Posts: 2,377
Website

Re: [SOLVED] writing PKGBUILD-conf files not treated properly (no pacnew)

Doesn't something like

backup=('etc/your-file.conf')

work for you?


:: Registered Linux User No. 223384

:: github
:: infinality-bundle+fonts: good looking fonts made easy

Offline

#3 2012-03-30 21:29:35

TiborB
Member
Registered: 2008-12-09
Posts: 103

Re: [SOLVED] writing PKGBUILD-conf files not treated properly (no pacnew)

No.
Of course I looked at this option and I have it in PKGBUILD.

BTW, from wiki:

backup

An array of files to be backed up as file.pacsave when the package is removed.

so this is something different

Offline

#4 2012-03-30 22:03:51

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] writing PKGBUILD-conf files not treated properly (no pacnew)

Can you post your PKGBUILD? I think bohoomil is right and the backup array protects your configs.
https://wiki.archlinux.org/index.php/Pa … ckup_files

Last edited by karol (2012-03-30 22:05:30)

Offline

#5 2012-03-30 22:16:54

TiborB
Member
Registered: 2008-12-09
Posts: 103

Re: [SOLVED] writing PKGBUILD-conf files not treated properly (no pacnew)

Karol,

here is my pkgbuild: http://pastebin.com/5BVD6c5S

indeed the link you posted confirms what you said, but I tested it once again now and it does not work. But test it by yourself, I wonder if it will work for you.....

Offline

#6 2012-03-30 22:26:18

TiborB
Member
Registered: 2008-12-09
Posts: 103

Re: [SOLVED] writing PKGBUILD-conf files not treated properly (no pacnew)

I'm sorry, my fault. I added backup=() option, but did not saved PKGBUILD. Yes, now it works... sorry sad


Administrators, feel free to delete this thread altogether....

Last edited by TiborB (2012-03-30 22:28:06)

Offline

#7 2012-03-30 22:27:16

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] writing PKGBUILD-conf files not treated properly (no pacnew)

[karol@black foo5]$ pacman -R repokeeper
checking dependencies...

Targets (1):

Name        Old Version  New Version  Net Change

repokeeper  0.0.3-1                    -0,03 MiB

Total Removed Size:     0,03 MiB

Do you want to remove these packages? [Y/n] 
(1/1) removing repokeeper                          [#############] 100%
warning: /etc/repokeeper.conf saved as /etc/repokeeper.conf.pacsave

When I reinstall the package,  /etc/repokeeper.conf is the default config, w/o my changes, as they are in /etc/repokeeper.conf.pacsave.



Edit: Ah, glad it's working :-)
I've edited the wiki, so that it mentions pacnew files too: https://wiki.archlinux.org/index.php/PKGBUILD#backup

Last edited by karol (2012-03-30 22:30:12)

Offline

#8 2012-03-30 22:31:19

TiborB
Member
Registered: 2008-12-09
Posts: 103

Re: [SOLVED] writing PKGBUILD-conf files not treated properly (no pacnew)

Karol, see my post above...

BTW, I talked about scenario when you reinstall (or update) the package. No removing the package in between.

Anyway, it works now...

Offline

#9 2012-03-30 22:35:40

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] writing PKGBUILD-conf files not treated properly (no pacnew)

TiborB wrote:

Karol, see my post above...

BTW, I talked about scenario when you reinstall (or update) the package. No removing the package in between.

Anyway, it works now...

I was just trying to figure out what could have gone wrong. That was the only thing that came to my mind, even though it was not exactly what you said you were doing.


TiborB wrote:

Administrators, feel free to delete this thread altogether....

No need for such drastic measures, just please remember to mark the thread as solved.

Offline

#10 2012-03-30 22:49:49

TiborB
Member
Registered: 2008-12-09
Posts: 103

Re: [SOLVED] writing PKGBUILD-conf files not treated properly (no pacnew)

Karol, if I can dare to suggest small modificaton to your wording in wiki:

An array of files that can contain user-made changes and should be preserved during update/remove of a package, primarily intended for configuration files in /etc.
When updating, new version will be saved as file.pacnew.  Similarly, when the package is removed, file will be preserved as file.pacsave. The file paths in this array should be relative paths (e.g. etc/pacman.conf) not absolute paths (e.g.
/etc/pacman.conf).
See also Pacnew and Pacsave Files.

Offline

#11 2012-03-30 23:13:53

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] writing PKGBUILD-conf files not treated properly (no pacnew)

Thanks for you suggestions, I've made some changes to that article.

One thing I want to point out:

When updating, new version may be saved as file.pacnew.

Arch wiki wrote:

original = X, current = Y, new = X
The original package and the new package both contain exactly the same version of the file, but the version currently in the filesystem has been modified. Leave the current version in place and discard the new version without notifying the user.

https://wiki.archlinux.org/index.php/Pa … es#.pacnew
If the new version provides the same config as the old version and I've modified that config file, there will be no pacnew file created when updating.


If you think https://wiki.archlinux.org/index.php/PKGBUILD#backup needs further refinement, just edit it yourself - it's a wiki after all :-)

Offline

#12 2012-03-31 19:41:37

TiborB
Member
Registered: 2008-12-09
Posts: 103

Re: [SOLVED] writing PKGBUILD-conf files not treated properly (no pacnew)

Karol,

I just want to say that the changes you made in wiki are very good, thanks

Offline

Board footer

Powered by FluxBB