You are not logged in.

#1 2014-04-26 04:20:11

thiagowfx
Member
Registered: 2013-07-09
Posts: 586

[SOLVED] Resetting config files from a package

Suppose I modify a file called /etc/examplefile.conf from a package example-package.

What is the easiest / most elegant way to reset this file? Reset = restore the file to its original, removing my modifications.

This[1] topic discusses this, but it is two years old. I would say the "best" solution there was the one suggested in #7:

you could move the config file first then reinstall.

But I'm not sure if this is safe. For a dummy example, removing /etc/pacman.conf then reinstalling pacman wouldn't probably be a good idea (I suspect this wouldn't work).

OBS.: Getting the original file from the package from the cache is an obvious solution, but I'm searching for a simpler (more direct) way to do this (a bash/zsh one-liner would be sufficient, for example).


[1]: https://bbs.archlinux.org/viewtopic.php?id=137526

Last edited by thiagowfx (2014-04-26 21:49:20)

Offline

#2 2014-04-26 04:25:58

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [SOLVED] Resetting config files from a package

I think pacman is a special case, since that is what you are using to actually install the package.  So of course if you move the config and break pacman it is not going to work.

But with most other packages the removal (or backup) of the config and then reinstallation seems like the easiest way to me.

Offline

#3 2014-04-26 11:25:27

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

Re: [SOLVED] Resetting config files from a package

Check out Xyne's pkg-extract_original http://xyne.archlinux.ca/projects/pkg_scripts/

Offline

#4 2014-04-26 21:49:04

thiagowfx
Member
Registered: 2013-07-09
Posts: 586

Re: [SOLVED] Resetting config files from a package

@WonderWoofy That's right, I guess this is still a good solution if one is in a hurry.

Thank you @karol, this is what I was expecting. This is a typical one-liner:

pkg-extract_original /etc/resolv.conf > /etc/resolv.conf

(Warning: do not try this with /etc/pacman.conf, it won't work...)

Offline

#5 2014-04-26 23:08:17

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

Re: [SOLVED] Resetting config files from a package

Offline

Board footer

Powered by FluxBB