Just FYI - Scripts updated to: (1) provide a -f | --force option to the fduparch.sh (wrapper) script to ignore the md5sum directory check and force a scan of all package and duplicate directories. (by default if dir md5sums are unchanged, duplicate scanning is skipped) (2) provide automatic clipping of long package names to terminal width with ellipse (...) indicators added to show clipping occurred. (stopped the kdeplasma-blah-blah... filenames from running off screen and wrapping) http://www.3111skyline.com/dl/arch/scripts/fduparch.sh http://www.3111skyline.com/dl/arch/scripts/fduppkg usage info below if interested: On 11/02/2011 11:41 PM, David C. Rankin wrote:
http://www.3111skyline.com/dl/arch/scripts/fduparch.sh http://www.3111skyline.com/dl/arch/scripts/fduppkg
For those not familiar with the scripts, they simply parse the files in /var/cache/pacman/pkg and move any duplicates (old versions) to a separate directory (/home/backup/pkg-1 by default). This does 2 things: (1) is cleans the pkg directory so that only current packages are present and (2) by moving duplicates to /home it frees space on the / partition. The files on the /home dir can be kept for a period of time or simply deleted.
The pair of scripts function as one script. The "wrapper" script 'fduparch.sh' simply calls 'fduppkg' setting the search dir and duplicate dir according to the directory array. fduppkg generically just removes duplicates (saving the most recent file) from dir_1 -> dir_2. They provide output advising of the duplicates found as well as logging detailed information about what was done to /home/backup/log/pkgdups.log.bz2.
By default, fduppkg is called 3 times:
/var/cache/pacman/pkg -> /home/backup/pkg-1 /home/backup/pkg-1 -> /home/backup/pkg-2 /home/backup/pkg-2 -> /home/backup/pkg-del
If you simply want to run the script once, just edit fduparch.sh and just remove directories from:
DIRLIST=( /var/cache/pacman/pkg /home/backup/pkg-1 /home/backup/pkg-2 /home/backup/pkg-del )
Making it:
DIRLIST=( /var/cache/pacman/pkg /home/backup/pkg-1 )
The scripts are reasonably commented, so they are easy to follow. The only requirement is that both be placed in /usr/local/bin (or just modify the script location in fduparch.sh) I just soft link then to /usr/local/bin. Obviously since they are moving files from the pkg directory, they must be run as root or the user must have sudo privileges. Output is verbose by default.
-- David C. Rankin, J.D.,P.E.