You are not logged in.
I wrote this simple script to speed up dealing with .pacnew and .pacsave files in my /etc directory. I was tired of doing it manually almost every day (find, diff, vi, mv, rm, again and again) and it was easy to make a mistake.
Additionally, it may be even more helpful for newbies who don't know where these files came from as it explains why pacman creates them.
All you need to do is to run dotpac (sorry, I didn't have time to think up a better name) and go through a few dialogs. Don't worry, dotpac will not do anything without your explicit command. Also please note that it doesn't offers automagic combining *.pac* files with their working equivalents.
Opinions, suggestions, ideas, bug reports are welcome.
Download: http://kenny.juvepoland.com/~swiergot/a … ils/dotpac
Wiki: http://wiki.archlinux.org/index.php/dotpac
PKGBUILD (by hellwoofa): http://aur.archlinux.org/packages.php?d … =1&ID=3017
Offline
Using `dialog` is nice, I never saw that one before. What you might add is some error checking, check if `rm` returned succesfull, or else display it's errormessage (like 'no permission')
I really quite like it btw good job!
Offline
superb! thank you very much, this should be on 0.8
Offline
This is a very nice tool. Thanks
I was first thinking that one might replace the lines that say "... the package that owns $file" with something using the output of pacman -Qo $file. But then I realized it might make the script really slow as sometimes pacman -Qo might take quite some time to give an output..
Offline
amazing tool.
And where were all the sportsmen who always pulled you though?
They're all resting down in Cornwall
writing up their memoirs for a paper-back edition
of the Boy Scout Manual.
Offline
I appears to be a bug in gpm. I can remember I used to have a similar error in mc but somehow it disappeared itself. I did some googling and it seems the only rescue for people experiencing this problem is running gpm. I have no idea why some people have this problem and some other don't.
Offline
I suppose the latest update to the gpm package should help.
Offline
didn't you made a PKGBUILD for aur? Your homepage is down atm
Offline
didn't you made a PKGBUILD for aur? Your homepage is down atm
I created a mirror for the moment
Offline
i hope you don't mind me using your mirror in the PKGBUILD that i'll get into the aur now? if so, pls contact me!
greetings,
hellwoofa
Offline
I could host it, if necessary. Only have 14GB per month spare, though.
Offline
Thank you guys. I have added an information about the PKGBUILD to the Wiki page. My website should be online by mid January but I think it would be safe to upload the script itself to the AUR.
Offline
if you know how to upload it to AUR (including it into the tarfile which is upped during the submission?), why don't you do it?
i hope i put in the right depends, im quite new to the whole stuff and thought that "coreutils + bash" are right
greetings,
hellwoofa
Offline
if you know how to upload it to AUR (including it into the tarfile which is upped during the submission?), why don't you do it?
![]()
i hope i put in the right depends, im quite new to the whole stuff and thought that "coreutils + bash" are right
![]()
greetings,
hellwoofa
You shouldn't forget `dialog` which isn't in base
Offline
excellent tool, IMHO should be moved to [extra] in 0.8
Favorite systems: ArchLinux, OpenBSD
"Yes, I love UNIX"
Offline
In english:
Hi
I found a "bug". I put a set -x at the begining of the bash script. This is the output after the crash:
+ '[' 0 '!=' 0 ']'
++ cat /tmp/tmp.Bnlek12255/exitcode
+ choice=1
++ expr 1 + 6
+ choice=7
++ sed -n 7p /tmp/tmp.Bnlek12255/dialog
++ cut -d ' ' -f 2
+ file=/etc/profile.pacold
+ [[ /etc/profile.pacold == *.pacnew ]]
+ [[ /etc/profile.pacold == *.pacsave ]]
+ echo 'It looks like you have found a bug. Please contact the author.'
It looks like you have found a bug. Please contact the author.
+ exit 3
I think I crated that /etc/profile.pacold file myself and the name is crashing dotpac.
A teraz po polsku:
Cześć
Znalazłem jakiś błąd, nie bardzo wiem o co chodzi, dopisałem set -x i wkleiłem powyżej komunikat który pozostał na ekranie po zakończeniu dotpac.
Z tego co pamiętam to sam stworzyłem ten plik /etc/profile.pacold a nazwa widocznie jest trochę nie fortunna. Może jakieś obejście jeśli nazwa nie pasuje do schematu?
Offline
Clearly a bug. By the way I have also added checking for presence of dialog and moved creation of tmpdir after all checks. New version of course at:
http://herkules.pcz.pl/~swiergot/dotpac
---
Dzięki. Nie przypuszczałem, że ten komunikat o błędzie na cokolwiek się przyda
Offline
How about dotpac take care about all .pac files not only in /etc ?
# find / -name *.pac*
/boot/grub/menu.lst.pacnew
/boot/grub/menu.lst.pacsave
/boot/kconfig26.pacsave
/boot/kconfig26mm.pacsave
/boot/kconfig26archck.pacsave
/opt/kde/share/config/kdm/kdmrc.pacsave
(I omitted the .packlist files from perl)
Offline
New version at:
http://kenny.juvepoland.com/~swiergot/a … ils/dotpac
ChangeLog:
- fixed the explanation for lone .pacsave files,
- search also in /boot.
Offline
Hi,
thanks for this little program : it works well
I have just one remark : instead of saying remove the new file, remove the new file and edit the old one, ... is it be possible to have the real file name instead of new and old ?
There are a lot of lies going around.... and half of them are true.
-- Winston Churchill
Offline
I was looking for something to use on a remote box. This fits the bill nicely. I changed my editor to nano as I'm not
proficient enough with vim....
Thanks.
Offline
Hi,
That's very handy, thanks. I realise this thread is 2 years old. Is it still maintained ?
Offline
I realise this thread is 2 years old. Is it still maintained ?
i wrote a similar script if you're interested:
#!/bin/bash
#
# PacNews
#
# pbrisbin 2009
#
###
message() {
echo ""
echo "pacnews is designed to streamline dealing with .pacnew files."
echo ""
echo "pacnews must be run as root, and will optionally accept a"
echo "directory on which to act, otherwise /etc will be searched by"
echo "default."
echo ""
echo "all *.pacnew files found will be presented to you one by one; "
echo "you'll have the option of viewing/editing your current config"
echo "file side by side with the pacnew file through vimdiff, then"
echo "you can remove the pacnew file, replace you're existing"
echo "config file with the .pacnew file, or do nothing."
echo ""
echo "answering anything other than \"y\" to the options will"
echo "eventually bring you back without changing your system in any"
echo "way."
echo ""
exit 1
}
errorout(){
echo "==> ERROR: $1"
exit 1
}
[ "$(whoami)" != "root" ] && errorout "You must be root"
which vimdiff >/dev/null 2>&1 || errorout "You need vimdiff installed"
if [ -z $1 ]; then
DIR="/etc"
elif [ "$1" = "--help" ]; then
message
else
[ -d $1 ] || errorout "$1 is not a directory, try --help"
DIR="$1"
fi
[ "$(find $DIR -name '*.pacnew')" = "" ] && {
echo "No .pacnew files found."
exit 0
}
for file in $(find $DIR -name '*.pacnew'); do
current="$(echo $file | sed 's/\.pacnew//g')"
echo -n ":: $file found, view differences? (Y/n) " && read A
if [ "$A" = "y" ]; then
vimdiff $current $file
echo -n ":: Remove $file? (Y/n) " && read A
if [ "$A" = "y" ]; then
rm $file || errorout "could not remove the pacnew file"
echo ">> $file was removed"
else
echo -n ":: Replace $current with $file? (Y/n) " && read A
if [ "$A" = "y" ]; then
cp $current $current.pacsave || errorout "could not back up existing config"
echo ">> $current saved as $current.pacsave"
mv $file $current || errorout "could not your config file"
echo ">> $current replaced by $file"
fi
fi
else
echo ">> Skipping $file..."
fi
done
exit 0
the most up to date version is always here as that's just a symlink to my ~/.bin
//github/
Offline
Dotpac is in AUR, I just installed it & it works a treat.
Thanks swiergot for scripting it for us & thanks hellwoofa for the PKGBUILD.
I know there are a few other options that do similar jobs, I haven't tried them, Dotpac does it for me.
I used to be surprised that I was still surprised by my own stupidity, finding it strangely refreshing.
Well, now I don't find it refreshing.
I'm over it!
Offline
dotpac is cool. simple and works.
found a bug:
- `diff -u "$1" "$2"` should be `diff -u "$2" "$1"` because now the pacnew gets '-' signs, and the pacold has '+', which is very confusing.
feature request:
- menu option for vimdiff. or maybe just run vimdiff alltogether instead of normal diff. you can use it to just view the diffs, and advanced users can use it to merge the files. or use a commandline argument to run vimdiff instead of diff.
host the source code on github and i'll fix it for you
Last edited by Dieter@be (2010-08-15 14:05:33)
< Daenyth> and he works prolifically
4 8 15 16 23 42
Offline