Lines 22-27
Link Here
|
22 |
BRACKET=$'\e[34;01m' |
22 |
BRACKET=$'\e[34;01m' |
23 |
BOLD=$'\e[1m' |
23 |
BOLD=$'\e[1m' |
24 |
|
24 |
|
|
|
25 |
ACTION="/bin/rm -vf" |
26 |
|
25 |
eerror () { |
27 |
eerror () { |
26 |
echo -e " ${BAD}*${NORMAL} $*" >> /dev/stderr |
28 |
echo -e " ${BAD}*${NORMAL} $*" >> /dev/stderr |
27 |
} |
29 |
} |
Lines 37-42
Link Here
|
37 |
echo -e " ${GOOD}*${NORMAL} $*" |
39 |
echo -e " ${GOOD}*${NORMAL} $*" |
38 |
} |
40 |
} |
39 |
|
41 |
|
|
|
42 |
print() { |
43 |
for x in $@; do |
44 |
if [ "${x}" = "" ]; then return 0 |
45 |
else /bin/echo $x |
46 |
fi |
47 |
done |
48 |
} |
49 |
|
40 |
ayuda () { |
50 |
ayuda () { |
41 |
echo "${HILITE}localepurge${NORMAL} for ${BOLD}Gentoo Linux${NORMAL} ${BRACKET}[${NORMAL} ${GOOD}${VERSION}${NORMAL} ${BRACKET}]${NORMAL}" |
51 |
echo "${HILITE}localepurge${NORMAL} for ${BOLD}Gentoo Linux${NORMAL} ${BRACKET}[${NORMAL} ${GOOD}${VERSION}${NORMAL} ${BRACKET}]${NORMAL}" |
42 |
echo -e " " "by bass@gentoo.org" |
52 |
echo -e " " "by bass@gentoo.org" |
Lines 47-52
Link Here
|
47 |
echo |
57 |
echo |
48 |
etab "${BOLD}-debug (-d) ${NORMAL} : debug mode." |
58 |
etab "${BOLD}-debug (-d) ${NORMAL} : debug mode." |
49 |
etab "${BOLD}-help (-h) ${NORMAL} : show this help." |
59 |
etab "${BOLD}-help (-h) ${NORMAL} : show this help." |
|
|
60 |
etab "${BOLD}-list (-l) ${NORMAL} : list directories to be cleared" |
50 |
etab "${BOLD}-nocolor (-nc) ${NORMAL} : no color mode." |
61 |
etab "${BOLD}-nocolor (-nc) ${NORMAL} : no color mode." |
51 |
etab "${BOLD}-pretend (-p) ${NORMAL} : pretend mode." |
62 |
etab "${BOLD}-pretend (-p) ${NORMAL} : pretend mode." |
52 |
etab "${BOLD}-verbose (-v) ${NORMAL} : verbose mode." |
63 |
etab "${BOLD}-verbose (-v) ${NORMAL} : verbose mode." |
Lines 82-96
Link Here
|
82 |
|
93 |
|
83 |
# Loop through the rest of the options |
94 |
# Loop through the rest of the options |
84 |
|
95 |
|
85 |
for x in $@ |
96 |
for x in $@; do |
86 |
do |
|
|
87 |
|
97 |
|
88 |
if [ "$x" = "-help" ] || [ "$x" = "-h" ]; then |
98 |
if [ "$x" = "-help" ] || [ "$x" = "-h" ]; then |
89 |
ayuda |
99 |
ayuda |
90 |
exit 0 |
100 |
exit 0 |
91 |
|
101 |
|
|
|
102 |
elif [ "$x" = "-list" ] || [ "$x" = "-l" ]; then |
103 |
LIST=enabled |
104 |
|
92 |
elif [ "$x" = "-pretend" ] || [ "$x" = "-p" ]; then |
105 |
elif [ "$x" = "-pretend" ] || [ "$x" = "-p" ]; then |
93 |
PRETEND=enabled |
106 |
PRETEND=enabled |
|
|
107 |
ACTION=print |
108 |
SHOWFREEDSPACE=disabled |
94 |
|
109 |
|
95 |
elif [ "$x" = "-verbose" ] || [ "$x" = "-v" ]; then |
110 |
elif [ "$x" = "-verbose" ] || [ "$x" = "-v" ]; then |
96 |
VERBOSE=enabled |
111 |
VERBOSE=enabled |
Lines 105-110
Link Here
|
105 |
exit 1 |
120 |
exit 1 |
106 |
fi |
121 |
fi |
107 |
|
122 |
|
|
|
123 |
if [ "${LIST}" = "enabled" ] && [ "${PRETEND}" = "enabled" ]; then |
124 |
eerror "Cannot have list and pretend mode enabled at the same time" |
125 |
eerror "Please enable one at a time" |
126 |
echo >> /dev/stderr |
127 |
eerror "For more information, see `basename $0` -help" |
128 |
fi |
129 |
|
108 |
done |
130 |
done |
109 |
|
131 |
|
110 |
# Do nothing and report why if no valid configuration file exists: |
132 |
# Do nothing and report why if no valid configuration file exists: |
Lines 146-155
Link Here
|
146 |
for LOCALE in `/bin/ls ${LOCALEDIR}`; do |
168 |
for LOCALE in `/bin/ls ${LOCALEDIR}`; do |
147 |
if echo "${PURGELIST}" | grep -xq ${LOCALE}; then |
169 |
if echo "${PURGELIST}" | grep -xq ${LOCALE}; then |
148 |
if [ -d ${LOCALEDIR}/${LOCALE}/LC_MESSAGES ]; then |
170 |
if [ -d ${LOCALEDIR}/${LOCALE}/LC_MESSAGES ]; then |
149 |
if [ "${PRETEND}" = "enabled" ]; then |
171 |
if [ "${LIST}" = "enabled" ]; then |
150 |
echo "${LOCALEDIR}/${LOCALE}" |
172 |
echo "${LOCALEDIR}/${LOCALE}" |
151 |
else |
173 |
else |
152 |
/bin/rm -vf `find ${LOCALEDIR}/${LOCALE} -type f` |
174 |
${ACTION} `find ${LOCALEDIR}/${LOCALE} -type f` |
153 |
fi |
175 |
fi |
154 |
fi |
176 |
fi |
155 |
fi |
177 |
fi |
Lines 183-192
Link Here
|
183 |
for LOCALE in `/bin/ls ${MANPAGEDIR} | grep -v ^man[1-9]`; do |
205 |
for LOCALE in `/bin/ls ${MANPAGEDIR} | grep -v ^man[1-9]`; do |
184 |
if echo "${PURGELIST}" | grep -xq ${LOCALE}; then |
206 |
if echo "${PURGELIST}" | grep -xq ${LOCALE}; then |
185 |
if [ -d ${MANPAGEDIR}/${LOCALE} ]; then |
207 |
if [ -d ${MANPAGEDIR}/${LOCALE} ]; then |
186 |
if [ "${PRETEND}" = "enabled" ]; then |
208 |
if [ "${LIST}" = "enabled" ]; then |
187 |
echo "${MANPAGEDIR}/${LOCALE}" |
209 |
echo "${MANPAGEDIR}/${LOCALE}" |
188 |
else |
210 |
else |
189 |
/bin/rm -f `find ${MANPAGEDIR}/${LOCALE} -type f` |
211 |
${ACTION} `find ${MANPAGEDIR}/${LOCALE} -type f` |
190 |
fi |
212 |
fi |
191 |
fi |
213 |
fi |
192 |
fi |
214 |
fi |
Lines 203-210
Link Here
|
203 |
fi |
225 |
fi |
204 |
} |
226 |
} |
205 |
|
227 |
|
|
|
228 |
[ "${LIST}" = "enabled" ] && [ "${VERBOSE}" = "enabled" ] && |
229 |
ewarn "If not in list mode, localepurge would clear the following directories:\n" |
230 |
|
206 |
[ "${PRETEND}" = "enabled" ] && [ "${VERBOSE}" = "enabled" ] && |
231 |
[ "${PRETEND}" = "enabled" ] && [ "${VERBOSE}" = "enabled" ] && |
207 |
ewarn "If not pretending, localepurge would clear the following directories:\n" |
232 |
ewarn "If not pretending, localepurge would delete the following files:\n" |
208 |
|
233 |
|
209 |
for folder in ${LOCALEDIRS}; do |
234 |
for folder in ${LOCALEDIRS}; do |
210 |
purgelocale "$folder" |
235 |
purgelocale "$folder" |