You are not logged in.

#1 2008-10-13 12:03:55

greenfuse
Member
Registered: 2008-02-14
Posts: 54

Managing pacsave and pacnew files

Sometimes it is a while before I do another 'pacman -Syu' ... so when I do I might find myself with a few .pacsave and .pacnew files to manage. To help myself deal with them I have written two simple little scripts to check and compare them quickly from the command line. I named the scripts diff_pacnew.sh and diff_pacsave.sh - and offer them here thinking it might be of interest to and maybe useful for forum members.

They use 'diff' to compare the existing file with the new one and prompt to enter a comment (such as "delete pacsave" or "add xyz to the file"). The comments are saved in /tmp/diff_pacsave.txt and /tmp/diff_pacnew.txt so I don't need to remember everything. I just read the txt files and alter/replace/remove the pacsave/pacnew files according to my notes there.

They use the 'locate' tool so I run 'updatedb' before using them.

#!/bin/bash  
#
# diff_pacsave.sh
# script used in Archlinux 
# to compare configuration files with their updated versions
for i in `locate *.pacsave`
do 
    j=`echo $i | sed 's/.pacsave//'`
    if [ -f $j ]
    then
        echo "...................."
        echo "comparing $i with $j"
        diff $i $j 
        echo "Enter notes"
        read notes
        echo "$j" >> /tmp/diff_pacsave.txt
               echo "$notes" >> /tmp/diff_pacsave.txt
        echo >> /tmp/diff_pacsave.txt
        echo
    fi
done
#!/bin/bash  
#
# diff_pacnew.sh
# script used in Archlinux 
# to compare configuration files with their updated versions
for i in `locate *.pacnew`
do 
    j=`echo $i | sed 's/.pacnew//'`
    if [ -f $j ]
    then
        echo "...................."
        echo "comparing $i with $j"
        diff $i $j 
        echo "Enter notes"
        read notes
        echo "$j" >> /tmp/diff_pacnew.txt
        echo "$notes" >> /tmp/diff_pacnew.txt
        echo >> /tmp/diff_pacnew.txt
        echo
    fi
done

Offline

Board footer

Powered by FluxBB