You are not logged in.

#1 2010-02-11 21:17:23

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,612
Website

newbie question - force a PKGBUILD to overwrite an exsiting conf file

With the new version from upstream comes a new .conf file.  What is the best way to force my PKGBUILD to move the old file to *.pacsave and force the new version to install?


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#2 2010-02-11 21:29:24

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: newbie question - force a PKGBUILD to overwrite an exsiting conf file

Not recommended. The new conf should be installed as .pacnew, and you should use an install message to advise users to change their configuration to the new format.

Offline

#3 2010-02-11 21:32:26

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,612
Website

Re: newbie question - force a PKGBUILD to overwrite an exsiting conf file

Can do... I have been working on a readme.install to this end.  One question about the pre_upgrade script.  /usr/share/pacman/proto.install states:

## arg 1:  the new package version
## arg 2:  the old package version
#post_upgrade() {
  # do something here
#}

I'm confused by the arg 1 and arg 2.  Is it simply the version number with nothing else.

EDIT: ok.. I get it,  Assign a variable to them to capture and check.

# $1: The new package version
# $2: The old package version
post_upgrade() {
NEW=`echo $1`
OLD=`echo $2`

if [ "$OLD" = "1.0.1" ]; then
 do something
fi

Last edited by graysky (2010-02-11 22:01:03)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#4 2010-02-11 22:05:10

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,612
Website

Re: newbie question - force a PKGBUILD to overwrite an exsiting conf file

Let's say the old series of packages is 1.0.1-x where x is 1,2,3,4, and 5.  How can I have the if then statement look to see if "$OLD" = "1.0.1-x"?

EDIT:  Nevermind:

NEW=`echo $1 | cut -f-1 -d '-'`
OLD=`echo $2 | cut -f-1 -d '-'`

Last edited by graysky (2010-02-11 22:13:33)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#5 2010-02-12 00:16:57

Daenyth
Forum Fellow
From: Boston, MA
Registered: 2008-02-24
Posts: 1,244

Re: newbie question - force a PKGBUILD to overwrite an exsiting conf file

Use vercmp instead. See the pkgtools install file for an example.

Offline

#6 2010-02-12 00:54:03

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,612
Website

Re: newbie question - force a PKGBUILD to overwrite an exsiting conf file

Daenyth wrote:

Use vercmp instead. See the pkgtools install file for an example.

http://repos.archlinux.org/wsvn/communi … ls.install

Thanks.

Last edited by graysky (2010-02-12 00:54:34)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

Board footer

Powered by FluxBB