The patch below adds some more directories to purge

---------- Forwarded message ----------
From: Luc Pionchon <[email protected]>
Date: 13 May 2013 12:15
Subject: [PATCH] add more folders to look at,
To: Niels Thykier <[email protected]>


Hi,

localepurge is missing directories with locale dependant data.

I cooked this patch for myself to add more directories to look at.
Of course because it deletes stuff as root, it must be double checked.

It would be better if there would be a way to configure where to look at.
See also https://bugs.launchpad.net/ubuntu/+source/localepurge/+bug/236183

Maybe it is usefull for others,

Luc


>From 3505a3f808eb7729df9150a871de26cf5d4583e8 Mon Sep 17 00:00:00 2001
From: Luc Pionchon <[email protected]>
Date: Mon, 13 May 2013 11:58:40 +0300
Subject: [PATCH] add more folders to look at,

- /usr/share/help/            <locale>/<domain>/HELP_CONTENT(files & dirs)
- /usr/share/help-langpack/   <locale>/<domain>/HELP_CONTENT(files & dirs)
- /usr/share/locale-langpack/ <locale>/LC_MESSAGES/*.mo
- /usr/share/omf-langpack/    <domain>/<domain>-<locale>.omf

And all again in /usr/local/
---
 debian/localepurge.8 | 12 ++++++++++++
 usr/sbin/localepurge | 45 +++++++++++++++++++++++++++++++++++++++++----
 2 files changed, 53 insertions(+), 4 deletions(-)

diff --git a/debian/localepurge.8 b/debian/localepurge.8
index 051c56e..b1b1b95 100644
--- a/debian/localepurge.8
+++ b/debian/localepurge.8
@@ -34,6 +34,18 @@ The contents of following directories will be
affected from removals:
 .br
 .BR \-\ /usr/share/omf
 .br
+.BR \-\ /usr/share/help
+.br
+.BR \-\ /usr/share/help-langpack
+.br
+.BR \-\ /usr/share/locale-langpack
+.br
+.BR \-\ /usr/share/omf-langpack
+.br
+And again the same directories but under:
+.br
+.BR \-\ /usr/local/
+.br
 The localization files you actually need and which you want to be
preserved on your system can be
 easily configured by running the following command:
 .br
diff --git a/usr/sbin/localepurge b/usr/sbin/localepurge
index e951497..a08022d 100755
--- a/usr/sbin/localepurge
+++ b/usr/sbin/localepurge
@@ -237,7 +237,7 @@ function spaceafter ()
     after=$(get_used_space "$dir")
     tot=$((before < after ? 0 : before - after))
     ((tot > 0)) && ((globaltot += tot))
-    echo "localepurge: Disk space freed in $dir: ${tot} KiB"
+    printf "localepurge: Disk space freed: %4d KiB in %s\n" ${tot} $dir
     fi
 }

@@ -245,17 +245,39 @@ function spaceafter ()
 ################################################################
 ## Now, get the job done

-for LDIR in /usr/share/{locale,man,gnome/help,omf,doc/kde/HTML}; do
+#---------------------------------------------------------------
+# Looking at:
+# /usr/share/locale/          <locale>/LC_MESSAGES/*.mo
+# /usr/share/man/             <locale>/(?)
+#                             man[1-8]
+# /usr/share/gnome/help/      <domain>/<locale>/HELP_CONTENT(files & dirs)
+# /usr/share/omf/             <domain>/<domain>-<locale>.omf
+# /usr/share/doc/kde/HTML/    (?)
+#
+# And also:
+# - /usr/share/help/            <locale>/<domain>/HELP_CONTENT(files & dirs)
+# - /usr/share/help-langpack/   <locale>/<domain>/HELP_CONTENT(files & dirs)
+# x /usr/share/locale-langpack/ <locale>/LC_MESSAGES/*.mo
+# x /usr/share/omf-langpack/    <domain>/<domain>-<locale>.omf
+#
+# And all again in /usr/local
+#---------------------------------------------------------------
+
+for LDIR in 
{/usr,/usr/local}/share/{locale,locale-langpack,man,gnome/help,help,help-langpack,omf,omf-langpack,doc/kde/HTML};
do
     if [ ! -d "$LDIR" ]; then continue; fi
     spacebefore "$LDIR"
     case "$LDIR" in

+    /usr/local/share/locale-langpack | \
+    /usr/local/share/locale          | \
+    /usr/share/locale-langpack       | \
     /usr/share/locale)
         ((VERBOSE)) && echo "localepurge: processing locale files ..."
         for locale in $(cd "$LDIR"; echo *); do
         remove_superfluous_files_under "$locale" "$LDIR/$locale"
         done ;;

+    /usr/local/share/man | \
     /usr/share/man)
         if ! ((MANDELETE)); then continue; fi
         ((VERBOSE)) && echo "localepurge: processing man pages ..."
@@ -263,8 +285,9 @@ for LDIR in
/usr/share/{locale,man,gnome/help,omf,doc/kde/HTML}; do
         remove_superfluous_files_under "$locale" "$LDIR/$locale"/man[1-9]
         done ;;

+    /usr/local/share/gnome/help | \
     /usr/share/gnome/help)
-        ((VERBOSE)) && echo "localepurge: processing Gnome files ..."
+        ((VERBOSE)) && echo "localepurge: processing GNOME files ..."
         for localedir in "$LDIR"/*/*; do
         locale=${localedir##*/}
         if [ -d "$localedir/../C" ]; then
@@ -272,8 +295,21 @@ for LDIR in
/usr/share/{locale,man,gnome/help,omf,doc/kde/HTML}; do
         fi
         done ;;

+    /usr/local/share/help-langpack  | \
+    /usr/local/share/help           | \
+    /usr/share/help-langpack        | \
+    /usr/share/help)
+        ((VERBOSE)) && echo "localepurge: processing GNOME files ..."
+        # <locale>/<domain>/HELP_CONTENT(files & dirs)
+        for locale in $(cd "$LDIR"; echo *); do
+            remove_superfluous_files_under "$locale" "$LDIR/$locale"
+        done ;;
+
+    /usr/local/share/omf-langpack  | \
+    /usr/local/share/omf           | \
+    /usr/share/omf-langpack        | \
     /usr/share/omf)
-        ((VERBOSE)) && echo "localepurge: processing Omf files ..."
+        ((VERBOSE)) && echo "localepurge: processing OMF files ..."
         for file in "$LDIR"/*/*; do
         locale=${file##*-}; locale=${locale%.omf}
         if [ -f "${file/%-$locale.omf/-C.omf}" ]; then
@@ -281,6 +317,7 @@ for LDIR in
/usr/share/{locale,man,gnome/help,omf,doc/kde/HTML}; do
         fi
         done ;;

+    /usr/local/share/doc/kde/HTML | \
     /usr/share/doc/kde/HTML)
         ((VERBOSE)) && echo "localepurge: processing KDE files ..."
         for locale in $(cd "$LDIR"; echo *); do
--
1.8.1.2


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to