Package: localepurge
Version: 0.5.9
Severity: wishlist
Tags: patch

As I was using symlinks(1) to clean up /usr/share/man and
/etc/alternatives this morning, I thought how convenient it would be to
have this optionally performed by localepurge at the end.

Here is a patch which runs "symlinks -r -d" on the the appropriate
directories if "SYMLINKS" is specified in the /etc/locale.nopurge file.

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.22-3-686 (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/bash

Versions of packages localepurge depends on:
ii  debconf [debconf-2.0]         1.5.17     Debian configuration management sy
ii  debianutils                   2.28.2     Miscellaneous utilities specific t
ii  dpkg                          1.14.12    package maintenance system for Deb
ii  locales                       2.7-3      GNU C Library: National Language (
ii  procps                        1:3.2.7-5  /proc file system utilities
ii  ucf                           3.004      Update Configuration File: preserv

localepurge recommends no packages.

-- debconf information:
* localepurge/showfreedspace: true
  localepurge/remove_no:
* localepurge/mandelete: true
* localepurge/quickndirtycalc: true
  localepurge/none_selected: false
* localepurge/nopurge: en, en_US.UTF-8
* localepurge/dontbothernew: false
* localepurge/verbose: false
--- a/etc/locale.nopurge 
+++ b/etc/locale.nopurge 
@@ -34,6 +34,10 @@
 #VERBOSE

 #####################################################
+# Run symlinks
+#SYMLINKS
+
+#####################################################
 # Following locales won't be deleted from this system
 # after package installations done with apt-get(8):

--- a/usr/sbin/localepurge       2007-12-06 15:36:02.000000000 -0500
+++ b/usr/sbin/localepurge 2007-12-06 15:32:21.000000000 -0500
@@ -214,6 +214,20 @@
     fi
 fi
 
+# Getting rid of dangling symlinks
+
+ALTDIR=/etc/alternatives
+SYMLINKSBIN=/usr/bin/symlinks
+
+if [ -x $SYMLINKSBIN -a "$(grep -x ^SYMLINKS /etc/locale.nopurge)" ]; then
+    if [ "$VERBOSE" = "enabled" ]; then
+        echo "localepurge: processing dangling symlinks ..."
+        $SYMLINKSBIN -d -r $LOCALEDIR $MANPAGEDIR $ALTDIR | grep dangling
+    else
+        $SYMLINKSBIN -d -r $LOCALEDIR $MANPAGEDIR $ALTDIR >/dev/null
+    fi
+fi
+
 # Calculating and reporting total disk space freed:
 
 if [ "$SHOWFREEDSPACE" = "enabled" ]; then

Reply via email to