I enhanced the localpurge script. Now it deletes .po files in /usr/share/locale, which were previously left alone, and deletes locale files under /usr/share/gnome/help.
===File /usr/sbin/localepurge=============================== #!/bin/sh # Deleting all locale files and localized man pages installed # on system which are *not* listed in /etc/locale.nopurge set -e # Do nothing and report why if no valid configuration file exists: if [ ! -f /etc/locale.nopurge ] then echo " No /etc/locale.nopurge file present, exiting ..." exit 0 else if [ "$(grep -x ^NEEDSCONFIGFIRST /etc/locale.nopurge)" ] then echo echo " You have to configure \"localepurge\" with the command" echo echo " dpkg-reconfigure localepurge" echo echo " to make $0 actually start to function." echo echo " Nothing to be done, exiting ..." echo exit 0 fi fi # Make sure to exclude running under any locale other than C: export LANG=C # Initialise local variables VERBOSE= DONTBOTHERNEWLOCALE=disabled SHOWFREEDSPACE=disabled mantot=0 localetot=0 gnometot=0 if [ "$1" = "-debug" ] || [ "$1" = "-d" ] \ || [ "$2" = "-debug" ] || [ "$2" = "-d" ]; then set -x fi if [ "$(grep -x ^SHOWFREEDSPACE /etc/locale.nopurge)" ]; then SHOWFREEDSPACE=enabled fi if [ "$(grep -x ^DONTBOTHERNEWLOCALE /etc/locale.nopurge)" ]; then DONTBOTHERNEWLOCALE=enabled fi if [ "$(grep -x ^VERBOSE /etc/locale.nopurge)" ] \ || [ "$1" = "-verbose" ] || [ "$1" = "-v" ] \ || [ "$2" = "-verbose" ] || [ "$2" = "-v" ]; then VERBOSE="-v" fi # Define a function for disk space calculation: if [ $SHOWFREEDSPACE = disabled ]; then get_used_space() { echo 0; } else if [ "$(grep -x ^QUICKNDIRTYCALC /etc/locale.nopurge)" ]; then get_used_space() # Usage: get_used_space <dirname> { [ -d "$1" ] || return 1 # bail out if there's no such dir set - $(df -P $1); shift $(($# - 6)); echo $3 } else get_used_space() # Usage: get_used_space <dirname> { [ -d "$1" ] || return 1 # bail out if there's no such dir set - $(du -ks $1); echo $1 } fi fi # first update $LOCALELIST with newly introduced locales if wanted LOCALELIST=/var/cache/localepurge/localelist NEWLOCALELIST="$LOCALELIST"-new if [ "$VERBOSE" ]; then echo "localepurge: checking system for new locale ..." fi for NEWLOCALE in $(cd /usr/share/locale; ls .) do if [ -d /usr/share/locale/$NEWLOCALE/LC_MESSAGES ]; then if [ ! "$(grep -cx $NEWLOCALE $LOCALELIST)" = "1" ]; then echo "$NEWLOCALE" >> "$NEWLOCALELIST" fi fi done if [ -f $NEWLOCALELIST ]; then if [ $DONTBOTHERNEWLOCALE = enabled ]; then mv "$NEWLOCALELIST" "$NEWLOCALELIST".temp sort -u "$NEWLOCALELIST".temp "$LOCALELIST"> "$NEWLOCALELIST" mv "$NEWLOCALELIST" "$LOCALELIST" rm "$NEWLOCALELIST".temp else mv "$NEWLOCALELIST" "$NEWLOCALELIST".temp sort -u "$NEWLOCALELIST".temp > "$NEWLOCALELIST" rm "$NEWLOCALELIST".temp fi fi if [ -f "$NEWLOCALELIST" ] && [ ! $DONTBOTHERNEWLOCALE = enabled ]; then echo "Some new locales have appeared on your system:" echo tr '\n' ' ' < "$NEWLOCALELIST" echo echo echo "They will not be touched until you reconfigure localepurge" echo "with the following command:" echo echo " dpkg-reconfigure localepurge" echo fi # Getting rid of superfluous locale files in LOCALEDIR LOCALEDIR=/usr/share/locale if [ -d "$LOCALEDIR" ]; then localebefore=$(get_used_space "$LOCALEDIR") test "$VERBOSE" && echo "localepurge: processing locale files ..." for LOCALE in $(cd "$LOCALEDIR"; echo *); do if [ ! "$(grep -x ^$LOCALE /etc/locale.nopurge)" ] && [ "$(grep -x ^$LOCALE $LOCALELIST)" ] && [ -d "$LOCALEDIR/$LOCALE/LC_MESSAGES" ]; then for file in "$LOCALEDIR/$LOCALE"/*/* "$LOCALEDIR/$LOCALE"/*.po; do if [ -f "$file" ] || [ -h "$file" ]; then /bin/rm $VERBOSE "$file" fi done fi done if [ $SHOWFREEDSPACE = enabled ]; then localeafter=$(get_used_space "$LOCALEDIR") ((localetot = localebefore - localeafter)) echo "localepurge: Disk space freed in $LOCALEDIR: ${localetot}KB" fi fi # Getting rid of localized man pages in $MANPAGEDIR MANPAGEDIR=/usr/share/man if [ -d $MANPAGEDIR ] && [ "$(grep -x ^MANDELETE /etc/locale.nopurge)" ]; then manbefore=$(get_used_space $MANPAGEDIR) test "$VERBOSE" && echo "localepurge: processing man pages ..." for LOCALE in $(ls --ignore="man[1-9]*" $MANPAGEDIR); do if [ ! "$(grep -x ^$LOCALE /etc/locale.nopurge)" ] && [ "$(grep -x ^$LOCALE $LOCALELIST)" ] && [ -d $MANPAGEDIR/$LOCALE ]; then for file in "$MANPAGEDIR/$LOCALE"/man[1-9]/*; do if [ -f "$file" ] || [ -h "$file" ]; then /bin/rm $VERBOSE "$file" fi done fi done if [ $SHOWFREEDSPACE = enabled ]; then manafter=$(get_used_space $MANPAGEDIR) ((mantot = manbefore - manafter)) echo "localepurge: Disk space freed in $MANPAGEDIR: ${mantot}KB" fi fi # Getting rid of superfluous locale files in Gnome GNOMEDIR=/usr/share/gnome/help if [ -d "$GNOMEDIR" ]; then gnomebefore=$(get_used_space "$GNOMEDIR") test "$VERBOSE" && echo "localepurge: processing Gnome files ..." for LOCALE in $(cd "$GNOMEDIR"; echo */*); do if [ ! "$(grep -x ${LOCALE##*/} /etc/locale.nopurge)" ] && [ "$(grep -x ^${LOCALE##*/} $LOCALELIST)" ] && [ ${LOCALE##*/} != C ] && [ -d "$GNOMEDIR/$LOCALE/../C" ]; then for file in "$GNOMEDIR/$LOCALE"/*/* "$GNOMEDIR/$LOCALE"/*.xml; do if [ -f "$file" ] || [ -h "$file" ]; then /bin/rm $VERBOSE "$file" fi done fi done if [ $SHOWFREEDSPACE = enabled ]; then gnomeafter=$(get_used_space "$GNOMEDIR") ((gnometot = gnomebefore - gnomeafter)) echo "localepurge: Disk space freed in $GNOMEDIR: ${gnometot}KB" fi fi # Calculating and reporting total disk space freed: if [ $SHOWFREEDSPACE = enabled ]; then echo echo "Total disk space freed by localepurge: $((localetot+mantot+gnometot))KB" echo fi ============================================================ -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org