You are not logged in.

#1 2013-06-17 19:38:57

cyker
Member
Registered: 2009-05-30
Posts: 67
Website

Checkout files from a pacman package

Just wonder whether it's possible to checkout files from a pacman package. Sometimes I want to revert a file to its stock version. For example:

pacman -checkout /etc/mpd.conf mpd.pkg.tar.xz 

.

Offline

#2 2013-06-17 19:40:18

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

Re: Checkout files from a pacman package

Arch packages are just compressed archives, so you can use standard tools like tar / bsdtar for this.

Offline

#3 2013-06-17 19:43:32

graysky
Member
From: /run/user/1000
Registered: 2008-12-01
Posts: 8,420
Website

Re: Checkout files from a pacman package

Or if it is just a package provided config file, use the web interface: https://www.archlinux.org/packages/


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

Offline

#4 2013-06-17 20:09:41

cyker
Member
Registered: 2009-05-30
Posts: 67
Website

Re: Checkout files from a pacman package

karol wrote:

Arch packages are just compressed archives, so you can use standard tools like tar / bsdtar for this.

Do you mean something like this?

tar -Jxvf /var/cache/pacman/pkg/mpd.pkg.tar.xz etc/mpd.conf -O > /etc/mpd.conf

It works but I need to manually find the package in cache and specify the filename. If pacman has an internal *checkout* feature things would be much easier.


.

Offline

#5 2013-06-17 20:19:47

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

Re: Checkout files from a pacman package

I haven't tested it much, but

bsdtar -qxf "/var/cache/pacman/pkg/$(pacman -Q $1 | tr ' ' -)-i686.pkg.tar.xz" $2

e.g.

bsdtar -qxf "/var/cache/pacman/pkg/$(pacman -Q pacman | tr ' ' -)-i686.pkg.tar.xz" etc/pacman.conf

should work.
You can create function and put it in your .bashrc.

Offline

#6 2013-06-17 21:04:05

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

Re: Checkout files from a pacman package

cyker wrote:

Sometimes I want to revert a file to its stock version.

Reinstall the package and reinstate the *.pacnew version of the file - man pacman if you need more details.

Offline

Board footer

Powered by FluxBB