In case anyone uses it, I updated my fduppkg script that scans /var/cache/pacman/pkg and moves duplicate packages to a separate directory so you can either keep the current + last package sets or just delete the dups. This update just cleans up the output and adds an -s | --silent option that suppresses all screen output and simply writes to the log file. Additionally the screen output has been cleaned up so it looks like this now:

[14:18 alchemy:/home/david] # fduparch

fduppkg /var/cache/pacman/pkg -d /home/backup/pkg-old -l 
/home/backup/pkgdups.log

Total packages to screen:  2858
Removing duplicates from:  /var/cache/pacman/pkg
Duplicates directory:      /home/backup/pkg-old
Log file location:         /home/backup/pkgdups.log
Verbose mode set:          [use -q to stop pkg output | -s to stop all output]

pkg [ 434] feh                         dup => feh-1.8-1-x86_64.pkg.tar.xz
pkg [ 727] gstreamer0 dup => gstreamer0.10-ugly-0.10.15-4-x86_64.pkg.tar.xz
pkg [ 785] gtranslator                 dup => 
gtranslator-1.9.7-1-x86_64.pkg.tar.gz
pkg [1446] kernel26-docs dup => kernel26-docs-2.6.35.3-1-x86_64.pkg.tar.xz
pkg [1869] lpsolve                     dup => 
lpsolve-5.5.0.15-1-x86_64.pkg.tar.gz
pkg [1895] madwifi                     dup => 
madwifi-0.9.4.4119-2-x86_64.pkg.tar.xz
pkg [2043] obexd-client                dup => 
obexd-client-0.29-3-x86_64.pkg.tar.xz
pkg [2070] openssh                     dup => openssh-5.5p1-1-x86_64.pkg.tar.xz
pkg [2263] pulseaudio                  dup => 
pulseaudio-0.9.21-8-x86_64.pkg.tar.xz
pkg [2399] ruby                        dup => 
ruby-1.9.1_p429-1-x86_64.pkg.tar.xz
pkg [2537] timidity++                  dup => 
timidity++-2.13.2-9-x86_64.pkg.tar.xz

11  duplicates moved to /home/backup/pkg-old

I've set the package name field width to 26 as a compromise to handle most package names. (You wouldn't have any screen left if it was wide enough for all the screwy kde4 50+ char package names). If the output above wraps -- you get the drift. In verbose mode (default) you get a summary showing the total number of packages to be screened, being moved from /var/cache/pacman/pkg to the dupdir you specify and the files moved are logged in the logfile you specify.

The package listing just shows the array index for the current package and any dups found are shown on the right. I find it handy, YMMV. The way I use it is to set up a 'wrapper script' to call fduppkg twice.

Once to move dups from /var/cache/pacman/pkg => /home/backup/pkg-old

Then again to move dups from /home/backup/pkg-old => /home/backup/pkg-older

That way I have the current set in /var/cache/pacman/pkg and a clean last installed set in /home/backup/pkg-old. Plus moving to /home/backup will offload the storage from / to /home partitions on most installs.

The main fduppkg scrip is here:

http://www.3111skyline.com/dl/Archlinux/scripts/fduppkg

The wrapper script I use to call fduppkg is here:

http://www.3111skyline.com/dl/Archlinux/scripts/fduparch.sh

I just link the scripts to /usr/local/bin as follows and then make sure /usr/local/bin is in your path:

lrwxrwxrwx 1 root root 32 Apr 18 19:17 fduparch -> /home/david/scr/arch/fduparch.sh lrwxrwxrwx 1 root root 28 Apr 18 19:18 fduppkg -> /home/david/scr/arch/fduppkg

Then once you have edited fduparch.sh and set the directories and options the way you like it, just call fduparch as root or 'sudo fduparch' and all dups will be moved to the directory you specify.

(NOTE: this script uses the package DATE to determine which is the newest package, so if you have somehow reset all the ctime or mtime info on your files by block copying them without preserving the file attributes, it won't work)

(Yes I know I have left comments and commented out stuff in the scripts, they are still works in progress :-)


--
David C. Rankin, J.D.,P.E.
Rankin Law Firm, PLLC
510 Ochiltree Street
Nacogdoches, Texas 75961
Telephone: (936) 715-9333
Facsimile: (936) 715-9339
www.rankinlawfirm.com

Reply via email to