Add localepurge package
Imported from Arch[1], with minor adaptations. [1] https://aur.archlinux.org/packages/localepurge
This commit is contained in:
parent
77d475caca
commit
28559f14ce
46
localepurge/PKGBUILD
Normal file
46
localepurge/PKGBUILD
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
# Maintainer: Nicolas Formichella <stigpro@outlook.fr>
|
||||||
|
# Contributor: Hyacinthe Cartiaux <hyacinthe.cartiaux @ free.fr>
|
||||||
|
# Contributor: Francesco Groccia <frgroccia gmail.com>
|
||||||
|
# Contributor: Dincer Celik <dincer@bornovali.com>
|
||||||
|
# Contributor: Orgad Shaneh <orgads @ gmail.com>
|
||||||
|
|
||||||
|
pkgname=localepurge
|
||||||
|
pkgver=0.7.3.10
|
||||||
|
pkgrel=1
|
||||||
|
pkgdesc="Script to remove disk space wasted for unneeded localizations."
|
||||||
|
arch=('any')
|
||||||
|
url="http://packages.debian.org/source/sid/localepurge"
|
||||||
|
license=('GPL')
|
||||||
|
backup=('etc/locale.nopurge')
|
||||||
|
source=("http://deb.debian.org/debian/pool/main/l/localepurge/${pkgname}_${pkgver}.tar.xz"
|
||||||
|
"${pkgname}.patch"
|
||||||
|
"${pkgname}.8.patch"
|
||||||
|
"${pkgname}.config.patch"
|
||||||
|
"locale.nopurge")
|
||||||
|
sha256sums=('56b08640f46d6ebf20b2d535e5ba54d062de70c8f2aadf5a5c665b6007f7f6e2'
|
||||||
|
'1713d521c6184cdaf5462b771fb340241d330e345f21bcd078594ac1fb277f32'
|
||||||
|
'8fda09c5e570282840818ad4c2bd7e0231b740e46d2d4ea185f7d0cf07369f6e'
|
||||||
|
'd2494a6135da835cf82cc1a5c5516792c09ad5d2f874df680380e4e31900e9e1'
|
||||||
|
'2eaf74647f6b94338c13489eb6b3a05ae1a27cbc5f3b88e5a73376c38f4f2bf5')
|
||||||
|
|
||||||
|
prepare()
|
||||||
|
{
|
||||||
|
cd "$srcdir/$pkgname-$pkgver"
|
||||||
|
patch -p1 < ${srcdir}/localepurge.patch
|
||||||
|
patch -p1 < ${srcdir}/localepurge.8.patch
|
||||||
|
patch -p1 < ${srcdir}/localepurge.config.patch
|
||||||
|
}
|
||||||
|
|
||||||
|
package()
|
||||||
|
{
|
||||||
|
install -D -m755 ${srcdir}/${pkgname}-${pkgver}/usr/sbin/localepurge ${pkgdir}/usr/bin/localepurge
|
||||||
|
install -D -m644 ${srcdir}/${pkgname}-${pkgver}/debian/localepurge.8 ${pkgdir}/usr/share/man/man8/localepurge.8
|
||||||
|
install -D -m755 ${srcdir}/${pkgname}-${pkgver}/debian/localepurge.config ${pkgdir}/usr/bin/localepurge-config
|
||||||
|
install -D -m644 locale.nopurge ${pkgdir}/etc/locale.nopurge
|
||||||
|
if [ -e /var/cache/localepurge/localelist ]; then
|
||||||
|
cp /var/cache/localepurge/localelist ${srcdir}/localelist
|
||||||
|
else
|
||||||
|
find /usr/share/locale -maxdepth 1 -type d -name "*" -printf "%f\n" | grep "^[a-z]" | cut -d" " -f1 | sort -u > ${srcdir}/localelist
|
||||||
|
fi
|
||||||
|
install -D -m644 ${srcdir}/localelist ${pkgdir}/var/cache/localepurge/localelist
|
||||||
|
}
|
||||||
53
localepurge/locale.nopurge
Normal file
53
localepurge/locale.nopurge
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
####################################################
|
||||||
|
# This is the configuration file for localepurge(8).
|
||||||
|
####################################################
|
||||||
|
# Comment this to enable localepurge.
|
||||||
|
# NO COMMENT IT IF YOU ARE NOT SURE WHAT ARE YOU DOING
|
||||||
|
# THIS APP DO NOT ASK FOR CONFIRMATION
|
||||||
|
|
||||||
|
NEEDSCONFIGFIRST
|
||||||
|
|
||||||
|
####################################################
|
||||||
|
# Uncommenting this string enables removal of localized
|
||||||
|
# man pages based on the configuration information for
|
||||||
|
# locale files defined below:
|
||||||
|
|
||||||
|
MANDELETE
|
||||||
|
|
||||||
|
####################################################
|
||||||
|
# Uncommenting this string causes localepurge to simply delete
|
||||||
|
# locales which have newly appeared on the system without
|
||||||
|
# bothering you about it:
|
||||||
|
|
||||||
|
#DONTBOTHERNEWLOCALE
|
||||||
|
|
||||||
|
#####################################################
|
||||||
|
# Commenting out this string enables faster but less
|
||||||
|
# accurate calculation of freed disk space:
|
||||||
|
|
||||||
|
#QUICKNDIRTYCALC
|
||||||
|
|
||||||
|
####################################################
|
||||||
|
# Uncommenting this string enables display of freed disk
|
||||||
|
# space if localepurge has purged any superfluous data:
|
||||||
|
|
||||||
|
SHOWFREEDSPACE
|
||||||
|
|
||||||
|
#####################################################
|
||||||
|
# Commenting out this string disables verbose output:
|
||||||
|
|
||||||
|
#VERBOSE
|
||||||
|
|
||||||
|
#####################################################
|
||||||
|
# You like Colors?
|
||||||
|
|
||||||
|
#NOCOLOR
|
||||||
|
|
||||||
|
#####################################################
|
||||||
|
# You can use the -v -d -nc options in command line.
|
||||||
|
|
||||||
|
#####################################################
|
||||||
|
# Following locales won't be deleted from this system
|
||||||
|
# for example:
|
||||||
|
en_US
|
||||||
|
en_US.UTF-8
|
||||||
143
localepurge/localepurge.8.patch
Normal file
143
localepurge/localepurge.8.patch
Normal file
@ -0,0 +1,143 @@
|
|||||||
|
diff -ur localepurge-0.7.3.10.orig/debian/localepurge.8 localepurge-0.7.3.10/debian/localepurge.8
|
||||||
|
--- localepurge-0.7.3.10.orig/debian/localepurge.8 2020-08-02 19:01:39.000000000 +0300
|
||||||
|
+++ localepurge-0.7.3.10/debian/localepurge.8 2021-09-05 10:50:44.409055400 +0300
|
||||||
|
@@ -1,4 +1,4 @@
|
||||||
|
-.TH LOCALEPURGE 8
|
||||||
|
+.TH LOCALEPURGE 8 "2013-09-21" "GNU/Linux" ""
|
||||||
|
.SH NAME
|
||||||
|
localepurge \- reclaim disk space removing unneeded localizations
|
||||||
|
.SH SYNOPSIS
|
||||||
|
@@ -7,15 +7,8 @@
|
||||||
|
.SH "DESCRIPTION"
|
||||||
|
.BR localepurge
|
||||||
|
is a small script to recover disk space wasted for unneeded locale
|
||||||
|
-files and localized man pages. It will be automagically invoked by
|
||||||
|
-.BR dpkg
|
||||||
|
-upon completion of any
|
||||||
|
-.BR apt
|
||||||
|
-installation run. You have to define the locale
|
||||||
|
-directory names you want to keep from removal after each
|
||||||
|
-.BR apt
|
||||||
|
-installation run
|
||||||
|
-in the
|
||||||
|
+files and localized man pages. You have to define the locale
|
||||||
|
+directory names you want to keep from removal in the
|
||||||
|
.BR /etc/locale.nopurge
|
||||||
|
configuration file. Unless
|
||||||
|
.BR localepurge
|
||||||
|
@@ -47,10 +40,17 @@
|
||||||
|
.BR \-\ /usr/share/vim/vim*/lang
|
||||||
|
.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:
|
||||||
|
+easily configured by editing the following file:
|
||||||
|
.br
|
||||||
|
-.BR dpkg-reconfigure\ localepurge
|
||||||
|
+.BR /etc/locale.nopurge
|
||||||
|
.br
|
||||||
|
+New locales discovered on your system will be listed in
|
||||||
|
+.I /var/cache/localepurge/localelist\-new
|
||||||
|
+and should be added to
|
||||||
|
+.I /var/cache/localepurge/localelist
|
||||||
|
+by the
|
||||||
|
+.BR /usr/bin/localepurge-config
|
||||||
|
+script.
|
||||||
|
.SH OPTIONS
|
||||||
|
The configurable options consist of toggling verbose output, reporting a
|
||||||
|
summary of freed space, and deletion of localized manual pages in
|
||||||
|
@@ -80,10 +80,10 @@
|
||||||
|
.BR not
|
||||||
|
.BR integrated
|
||||||
|
.BR with
|
||||||
|
-.BR Debian's
|
||||||
|
+.BR "Arch Linux's"
|
||||||
|
.BR package
|
||||||
|
.BR management
|
||||||
|
-.BR system
|
||||||
|
+.BR system
|
||||||
|
and therefore is not meant for the faint of heart. Responsibility for its
|
||||||
|
usage and possible breakage of your system therefore lies in the sysadmin's
|
||||||
|
(your) hands.
|
||||||
|
@@ -97,60 +97,12 @@
|
||||||
|
All locale directories from the affected paths listed above which are either
|
||||||
|
commented out or not even listed at all in
|
||||||
|
.BR /etc/locale.nopurge
|
||||||
|
-will be irreversibly deleted. The only way to
|
||||||
|
-reinstall any lost locales is a complete reinstallation of all the
|
||||||
|
-Debian packages containing them. See
|
||||||
|
-.BR /usr/share/doc/localepurge/reinstall_debs.sh
|
||||||
|
-for a recipe.
|
||||||
|
-Alternatively you can reconfigure
|
||||||
|
-it with
|
||||||
|
-.BR dpkg-reconfigure(8)
|
||||||
|
-to prevent locale files from being purged during subsequent runs of apt.
|
||||||
|
-.br
|
||||||
|
-.SH SOLVING PROBLEMS caused by localepurge
|
||||||
|
-This program does interfere with the Debian package management and does
|
||||||
|
-provoke strange, but usually harmless, behaviour of programs related
|
||||||
|
-with
|
||||||
|
-.BR apt/dpkg
|
||||||
|
-like
|
||||||
|
-.BR dpkg-repack(1),
|
||||||
|
-.BR debsums(1),
|
||||||
|
-.BR reportbug(1),
|
||||||
|
-etc.
|
||||||
|
-If you need to have any package in its full integrity so that e.g. the
|
||||||
|
-formerly mentioned programs work as designed by its author and as
|
||||||
|
-expected by you, simply deinstall
|
||||||
|
-.BR localepurge
|
||||||
|
-temporarily without purging its configuration and reinstall the packages
|
||||||
|
-you need in their fully integral state. When you are done with what you
|
||||||
|
-needed the integral packages for simply reinstall
|
||||||
|
-.BR localepurge
|
||||||
|
-again.
|
||||||
|
-
|
||||||
|
+will be irreversibly deleted. The only way to reinstall any lost
|
||||||
|
+locales is a complete reinstallation of all the Arch Linux packages
|
||||||
|
+containing them. For more information, see "Reinstalling all installed packages"
|
||||||
|
+at http://wiki.archlinux.org/index.php/Pacman_Tips.
|
||||||
|
.SH FILES
|
||||||
|
.BR /etc/locale.nopurge
|
||||||
|
-.SH SEE ALSO
|
||||||
|
-Administrators of systems with short disk space should have a look
|
||||||
|
-at both the
|
||||||
|
-.BR deborphan
|
||||||
|
-and
|
||||||
|
-.BR debfoster
|
||||||
|
-packages. Especially
|
||||||
|
-.BR debfoster
|
||||||
|
-can work wonders for your scarce disk space!
|
||||||
|
-
|
||||||
|
-.br
|
||||||
|
-.BR deborphan(1)
|
||||||
|
-.br
|
||||||
|
-.BR debfoster(8)
|
||||||
|
-.br
|
||||||
|
-.BR dpkg-reconfigure(8)
|
||||||
|
-.br
|
||||||
|
-.BR debconf(8)
|
||||||
|
-.br
|
||||||
|
-.BR /usr/share/doc/localepurge/README.debian
|
||||||
|
-.br
|
||||||
|
-.BR /usr/share/doc/localepurge/reinstall_debs.sh
|
||||||
|
.SH AUTHOR
|
||||||
|
.BR localepurge
|
||||||
|
and its accompanying manual page was written for the
|
||||||
|
@@ -164,3 +116,17 @@
|
||||||
|
Debian's great package management system will make
|
||||||
|
.BR localepurge
|
||||||
|
fully obsolete.
|
||||||
|
+.SH NOTE
|
||||||
|
+This manual page and the Debian localepurge script have been modified
|
||||||
|
+for Arch Linux system by Francesco Groccia <frgroccia gmail.com>.
|
||||||
|
+Some Debian\-specific information has been removed.
|
||||||
|
+.br
|
||||||
|
+In particular, the following files have been revised from the
|
||||||
|
+localepurge source code (Debian "sid" distribution):
|
||||||
|
+.HP
|
||||||
|
+
|
||||||
|
+.I ../debian/localepurge.8
|
||||||
|
+
|
||||||
|
+.I ../debian/localepurge.config
|
||||||
|
+
|
||||||
|
+.I ../usr/sbin/localepurge
|
||||||
148
localepurge/localepurge.config.patch
Normal file
148
localepurge/localepurge.config.patch
Normal file
@ -0,0 +1,148 @@
|
|||||||
|
diff -ur localepurge-0.7.3.10.orig/debian/localepurge.config localepurge-0.7.3.10/debian/localepurge.config
|
||||||
|
--- localepurge-0.7.3.10.orig/debian/localepurge.config 2020-08-02 19:01:39.000000000 +0300
|
||||||
|
+++ localepurge-0.7.3.10/debian/localepurge.config 2021-09-05 10:50:44.494063300 +0300
|
||||||
|
@@ -2,26 +2,11 @@
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
-. /usr/share/debconf/confmodule
|
||||||
|
-
|
||||||
|
# first get all possible locales and create a full list of locale values:
|
||||||
|
|
||||||
|
-CONFIG_FILE="/etc/locale.nopurge"
|
||||||
|
TEMPFILE="$(mktemp --suffix ".locales")"
|
||||||
|
LOCALELIST=/var/cache/localepurge/localelist
|
||||||
|
|
||||||
|
-conf_has_key() {
|
||||||
|
- local key="$1"
|
||||||
|
-
|
||||||
|
- if [ -f "$CONFIG_FILE" ] && fgrep --quiet --line-regexp \
|
||||||
|
- "$key" "$CONFIG_FILE"; then
|
||||||
|
- echo "true"
|
||||||
|
- else
|
||||||
|
- echo "false"
|
||||||
|
- fi
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-
|
||||||
|
# for the purpose of presenting a ready made preselection at the very first
|
||||||
|
# configuration, include already configured locales from locales package:
|
||||||
|
|
||||||
|
@@ -46,9 +31,7 @@
|
||||||
|
|
||||||
|
# include locales supported by the locales package:
|
||||||
|
|
||||||
|
-if [ -f /usr/share/i18n/SUPPORTED ]; then
|
||||||
|
- grep ^[a-z] /usr/share/i18n/SUPPORTED | cut -d' ' -f1 | sort -u >> "$TEMPFILE"
|
||||||
|
-fi
|
||||||
|
+find /usr/share/locale -maxdepth 1 -type d -name "*" -printf "%f\n" | grep "^[a-z]" | cut -d" " -f1 | sort -u >> "$TEMPFILE"
|
||||||
|
|
||||||
|
# include locales from our previous localelist if it already exists:
|
||||||
|
|
||||||
|
@@ -59,8 +42,7 @@
|
||||||
|
# include locales from newly added locales:
|
||||||
|
NEWLOCALELIST="$LOCALELIST"-new
|
||||||
|
|
||||||
|
-if [ -f "$NEWLOCALELIST" ] && \
|
||||||
|
- [ $(ps w -p "$PPID" | grep -c dpkg-reconfigure) = "1" ]; then
|
||||||
|
+if [ -f "$NEWLOCALELIST" ]; then
|
||||||
|
cat "$NEWLOCALELIST" >> "$TEMPFILE"
|
||||||
|
rm -f "$NEWLOCALELIST"
|
||||||
|
fi
|
||||||
|
@@ -79,96 +61,9 @@
|
||||||
|
else
|
||||||
|
mv "$LOCALELIST" "$LOCALELIST"-old
|
||||||
|
sort -u "$TEMPFILE" > "$LOCALELIST"
|
||||||
|
-fi
|
||||||
|
-
|
||||||
|
-# finally sort and create full list of all collected locale names
|
||||||
|
-
|
||||||
|
-LOCALES=$(sort -u "$TEMPFILE" | tr '\n' ' ' \
|
||||||
|
- | sed 's/\ /,\ /g' | sed 's/,\ $//g')
|
||||||
|
-
|
||||||
|
-if [ -f "$CONFIG_FILE" ] ; then
|
||||||
|
- # Update the debconf database
|
||||||
|
- PRESELECT="$(grep --extended-regexp '^[[:lower:]][[:lower:]]' \
|
||||||
|
- "$CONFIG_FILE" | tr '\n' ' ' | sed 's/\ /,\ /g' | \
|
||||||
|
- sed 's/,\ $//g')"
|
||||||
|
- db_set localepurge/nopurge "$PRESELECT"
|
||||||
|
-
|
||||||
|
- db_set localepurge/use-dpkg-feature "$(conf_has_key USE_DPKG)"
|
||||||
|
- db_set localepurge/mandelete "$(conf_has_key MANDELETE)"
|
||||||
|
- db_set localepurge/dontbothernew "$(conf_has_key DONTBOTHERNEWLOCALE)"
|
||||||
|
- db_set localepurge/showfreedspace "$(conf_has_key SHOWFREEDSPACE)"
|
||||||
|
- db_set localepurge/quickndirtycalc "$(conf_has_key QUICKNDIRTYCALC)"
|
||||||
|
- db_set localepurge/verbose "$(conf_has_key VERBOSE)"
|
||||||
|
-
|
||||||
|
-else
|
||||||
|
-
|
||||||
|
- # sort and create preselection values from "$LOCALEGEN"
|
||||||
|
-
|
||||||
|
- PRESELECT=$(sort -u "$LOCALEGEN" | tr '\n' ' ' \
|
||||||
|
- | sed 's/\ /,\ /g' | sed 's/,\ $//g')
|
||||||
|
fi
|
||||||
|
|
||||||
|
# deleting temporary files not needed anymore:
|
||||||
|
|
||||||
|
rm -f "$TEMPFILE" "$LOCALEGEN"
|
||||||
|
|
||||||
|
-#############################################################
|
||||||
|
-# now that all locale data is in place let debconf take over:
|
||||||
|
-
|
||||||
|
-db_subst localepurge/nopurge locales "$LOCALES"
|
||||||
|
-
|
||||||
|
-# uncomment for debugging:
|
||||||
|
-#echo "$LOCALES" > /tmp/locales.list
|
||||||
|
-
|
||||||
|
-db_get localepurge/nopurge
|
||||||
|
-if [ "$RET" = "" ] && [ "$RET" != "PURGE_ALL" ] \
|
||||||
|
- || [ "$RET" = "NEEDSCONFIGFIRST" ]; then
|
||||||
|
- db_set localepurge/nopurge "$PRESELECT"
|
||||||
|
- db_fset localepurge/nopurge seen false
|
||||||
|
- # uncomment for debugging:
|
||||||
|
- #echo "$PRESELECT" > /tmp/preselect.list
|
||||||
|
-fi
|
||||||
|
-
|
||||||
|
-db_input high localepurge/nopurge || true
|
||||||
|
-db_go
|
||||||
|
-
|
||||||
|
-db_get localepurge/nopurge
|
||||||
|
-if [ "$RET" = "" ] || [ "$RET" = "PURGE_ALL" ]; then
|
||||||
|
- db_input high localepurge/none_selected || true
|
||||||
|
- db_go
|
||||||
|
-
|
||||||
|
- db_get localepurge/none_selected
|
||||||
|
- if [ "$RET" = "false" ]; then
|
||||||
|
- db_input high localepurge/remove_no || true
|
||||||
|
- db_go
|
||||||
|
- fi
|
||||||
|
-fi
|
||||||
|
-
|
||||||
|
-db_input high localepurge/use-dpkg-feature || true
|
||||||
|
-db_go
|
||||||
|
-if [ "$RET" = "" -o "$RET" = "true" ] ; then
|
||||||
|
- USE_DPKG=yes
|
||||||
|
-else
|
||||||
|
- USE_DPKG=no
|
||||||
|
-fi
|
||||||
|
-
|
||||||
|
-db_input medium localepurge/mandelete || true
|
||||||
|
-db_go
|
||||||
|
-
|
||||||
|
-if [ "$USE_DPKG" = "xno" ] ; then
|
||||||
|
- # Features incompatible with the dpkg approach.
|
||||||
|
- db_input medium localepurge/dontbothernew || true
|
||||||
|
- db_go
|
||||||
|
-
|
||||||
|
- db_input low localepurge/showfreedspace || true
|
||||||
|
- db_go
|
||||||
|
-
|
||||||
|
- db_get localepurge/showfreedspace
|
||||||
|
- if [ "$RET" = "true" ]; then
|
||||||
|
- db_input low localepurge/quickndirtycalc || true
|
||||||
|
- db_go
|
||||||
|
- fi
|
||||||
|
-
|
||||||
|
- db_input low localepurge/verbose || true
|
||||||
|
- db_go
|
||||||
|
-fi
|
||||||
189
localepurge/localepurge.patch
Normal file
189
localepurge/localepurge.patch
Normal file
@ -0,0 +1,189 @@
|
|||||||
|
diff -ur localepurge-0.7.3.10.orig/usr/sbin/localepurge localepurge-0.7.3.10/usr/sbin/localepurge
|
||||||
|
--- localepurge-0.7.3.10.orig/usr/sbin/localepurge 2020-08-02 19:01:39.000000000 +0300
|
||||||
|
+++ localepurge-0.7.3.10/usr/sbin/localepurge 2021-09-05 10:50:44.334801200 +0300
|
||||||
|
@@ -1,6 +1,6 @@
|
||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
-# Deleting all locale files and localized man pages installed
|
||||||
|
+# Deleting all locale files and localized man pages installed
|
||||||
|
# on system which are *not* listed in /etc/locale.nopurge
|
||||||
|
|
||||||
|
set -e
|
||||||
|
@@ -12,48 +12,35 @@
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$1" = "--help" ] || [ "$1" = "-h" ]; then
|
||||||
|
- echo ""
|
||||||
|
- echo "Verbose output is triggered with option '-v' or '-verbose'."
|
||||||
|
- echo "Debugging output is triggered with option '-d' or '-debug'."
|
||||||
|
- echo "To reconfigure it, run 'dpkg-reconfigure localepurge'."
|
||||||
|
- echo "Documentation is either available via 'man localepurge'"
|
||||||
|
- echo "or by reading the docs in /usr/share/doc/localepurge."
|
||||||
|
- echo ""
|
||||||
|
- if [ -f $NOPURGECONF ] && fgrep --quiet --line-regexp USE_DPKG $NOPURGECONF ; then
|
||||||
|
- echo "NB: localepurge has been configured to use dpkg. Therefore,"
|
||||||
|
- echo "this script will not do anything."
|
||||||
|
- fi
|
||||||
|
- exit 0
|
||||||
|
+ echo ""
|
||||||
|
+ echo "Verbose output is triggered with option '-v' or '-verbose'."
|
||||||
|
+ echo "Debugging output is triggered with option '-d' or '-debug'."
|
||||||
|
+ echo "To reconfigure it, edit /etc/locale.nopurge file."
|
||||||
|
+ echo "Documentation is available via 'man 8 localepurge'."
|
||||||
|
+ echo ""
|
||||||
|
+ exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
-
|
||||||
|
# Do nothing and report why if no valid configuration file exists:
|
||||||
|
|
||||||
|
-if [ ! -f $NOPURGECONF ]
|
||||||
|
- then
|
||||||
|
- echo " No $NOPURGECONF file present, exiting ..."
|
||||||
|
+if [ ! -f $NOPURGECONF ]; then
|
||||||
|
+ echo " No $NOPURGECONF file present, exiting ..."
|
||||||
|
+ exit 0
|
||||||
|
+else
|
||||||
|
+ if fgrep --quiet --line-regexp NEEDSCONFIGFIRST $NOPURGECONF ; then
|
||||||
|
+ echo
|
||||||
|
+ echo " You have to configure \"localepurge\" by editing"
|
||||||
|
+ echo
|
||||||
|
+ echo " /etc/locale.nopurge file"
|
||||||
|
+ echo
|
||||||
|
+ echo " to make $0 actually start to function."
|
||||||
|
+ echo
|
||||||
|
+ echo " Nothing to be done, exiting ..."
|
||||||
|
+ echo
|
||||||
|
exit 0
|
||||||
|
- else
|
||||||
|
- if fgrep --quiet --line-regexp USE_DPKG $NOPURGECONF
|
||||||
|
- then
|
||||||
|
- # Do nothing, dpkg does all the work for us.
|
||||||
|
- exit 0
|
||||||
|
- elif fgrep --quiet --line-regexp NEEDSCONFIGFIRST $NOPURGECONF
|
||||||
|
- 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
|
||||||
|
fi
|
||||||
|
|
||||||
|
-
|
||||||
|
################################################################
|
||||||
|
## Initialise variables
|
||||||
|
|
||||||
|
@@ -85,7 +72,6 @@
|
||||||
|
VERBOSE=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
-
|
||||||
|
################################################################
|
||||||
|
## Manage the list of locales
|
||||||
|
|
||||||
|
@@ -97,57 +83,57 @@
|
||||||
|
|
||||||
|
((VERBOSE)) && echo "localepurge: checking for existence of $LOCALECACHEDIR..."
|
||||||
|
if [ ! -d $LOCALECACHEDIR ]; then
|
||||||
|
- mkdir -m 644 -p $LOCALECACHEDIR
|
||||||
|
+ mkdir -m 644 -p $LOCALECACHEDIR
|
||||||
|
fi
|
||||||
|
|
||||||
|
((VERBOSE)) && echo "localepurge: checking for existence of $LOCALELIST..."
|
||||||
|
if [ ! -f $LOCALELIST ]; then
|
||||||
|
- touch $LOCALELIST && chmod 664 $LOCALELIST
|
||||||
|
+ touch $LOCALELIST && chmod 664 $LOCALELIST
|
||||||
|
fi
|
||||||
|
|
||||||
|
((VERBOSE)) && echo "localepurge: checking system for new locale ..."
|
||||||
|
|
||||||
|
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"
|
||||||
|
+do
|
||||||
|
+ if [ -d /usr/share/locale/$NEWLOCALE/LC_MESSAGES ]; then
|
||||||
|
+ if [ ! "$(grep -cx $NEWLOCALE $LOCALELIST)" = "1" ]; then
|
||||||
|
+ echo "$NEWLOCALE" >> "$NEWLOCALELIST"
|
||||||
|
+ fi
|
||||||
|
fi
|
||||||
|
- fi
|
||||||
|
done
|
||||||
|
|
||||||
|
for NEWLOCALE in $(ls --ignore="man[1-9]*" /usr/share/man)
|
||||||
|
-do
|
||||||
|
- if [ -d /usr/share/man/$NEWLOCALE/man1 ] || [ -d /usr/share/man/$NEWLOCALE/man8 ]; then
|
||||||
|
- if [ ! "$(grep -cx $NEWLOCALE $LOCALELIST)" = "1" ]; then
|
||||||
|
- echo "$NEWLOCALE" >> "$NEWLOCALELIST"
|
||||||
|
+do
|
||||||
|
+ if [ -d /usr/share/man/$NEWLOCALE/man1 ] || [ -d /usr/share/man/$NEWLOCALE/man8 ]; then
|
||||||
|
+ if [ ! "$(grep -cx $NEWLOCALE $LOCALELIST)" = "1" ]; then
|
||||||
|
+ echo "$NEWLOCALE" >> "$NEWLOCALELIST"
|
||||||
|
+ fi
|
||||||
|
fi
|
||||||
|
- fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -f $NEWLOCALELIST ]; then
|
||||||
|
- if ((DONTBOTHERNEWLOCALE)); 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
|
||||||
|
+ if ((DONTBOTHERNEWLOCALE)); 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 != yes ]; then
|
||||||
|
echo "Some new locales have appeared on your system:"
|
||||||
|
echo
|
||||||
|
- tr '\n' ' ' < "$NEWLOCALELIST"
|
||||||
|
+ 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 " /usr/bin/localepurge-config"
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
|
||||||
|
@@ -202,7 +188,7 @@
|
||||||
|
local flag
|
||||||
|
((VERBOSE)) && flag=-v
|
||||||
|
for file; do
|
||||||
|
- if [ -f "$file" ] || [ -h "$file" ]; then
|
||||||
|
+ if [ -f "$file" ] || [ -h "$file" ]; then
|
||||||
|
echo "$file"
|
||||||
|
fi
|
||||||
|
done | xargs rm $flag
|
||||||
|
@@ -244,7 +230,6 @@
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
-
|
||||||
|
################################################################
|
||||||
|
## Now, get the job done
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user