cookutils view modules/compressor @ rev 978

modules/compressor: process png images with the spaces in the path.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Fri Oct 13 14:01:28 2017 +0300 (2017-10-13)
parents 63fb59f6fd67
children ae3975981d3f
line source
1 #!/bin/sh
2 #
3 # compressor - module of the SliTaz Cook
4 # Copyright (C) SliTaz GNU/Linux - GNU GPL v3
5 #
7 . /usr/lib/slitaz/libcook.sh
9 # Compressor cache stuff
11 comp_cache_root='/home/slitaz/cache/cook'
12 mkdir -p "$comp_cache_root"
13 cache_stat=$(mktemp)
15 # Cache notes.
16 # Do not do the same job twice. Getting the file from the cache is much faster
17 # than compressing the file one more time. In addition, this cache is trying not
18 # to take extra space, using the hardlinks. Although the files from the cache
19 # without reference to itself should be removed periodically.
24 #
25 # Functions
26 #
29 # tazpkg install command
31 tpi() {
32 tazpkg -gi --quiet --local --cookmode $1
33 }
36 # Working with time (with hundredths precision)
38 get_time() {
39 cut -d" " -f2 /proc/uptime
40 }
42 calc_time() {
43 # L10n: 's' is for seconds, 'm' is for minutes
44 awk -va="$1" -vb="$(get_time)" -vs="$(_ 's')" -vm="$(_ 'm')" '
45 BEGIN{
46 time = b - a;
47 if (time < 30)
48 printf("%.2f%s\n", time, s);
49 else
50 printf("%.2f%s ~ %.0f%s\n", time, s, time / 60, m);
51 }'
52 }
55 # Compressor mini summary
57 comp_summary() {
58 # "$time0" "$size0" "$size1"
59 status
60 [ "$2" -eq 0 ] && return
61 saving=$(awk -va="$2" -vb="$3" 'BEGIN{ printf("%.0f\n", (a - b) / 1024) }')
62 cache_msg=''
63 if [ -s "$cache_stat" ]; then
64 cache_msg=$(_n ' Cache hit: %d/%d.' "$(fgrep '+' $cache_stat | wc -l)" "$(wc -l < $cache_stat)")
65 echo -n > $cache_stat
66 fi
67 _ ' Time: %s. Size: %s B -> %s B. Save: %s KB.%s' \
68 "$(calc_time $1)" "$2" "$3" "$saving" "$cache_msg"
69 }
72 # Calculating different sizes
74 sizes() {
75 case $1 in
76 man) find $install/usr/share/man -type f -exec ls -l \{\} \; ;;
77 png) find $install -type f -name '*.png' -exec ls -l \{\} \; ;;
78 svg) find $install -type f -name '*.svg' -exec ls -l \{\} \; ;;
79 xml) find $install -type f \( -name '*.ui' -o -name '*.glade' \) -exec ls -l \{\} \; ;;
80 des) find $install -type f -name '*.desktop' -exec ls -l \{\} \; ;;
81 mo1) find $install -type f -name '*.mo' -exec ls -l \{\} \; ;;
82 loc) find $install/usr/share/i18n/locales -type f -exec ls -l \{\} \; ;;
83 mo2) find $fs/usr/share/locale -type f -name '*.mo' -exec ls -l \{\} \; ;;
84 gz) find $install -type f -name '*.gz' ! -path '*/share/man/*' -exec ls -l \{\} \; ;;
85 zip) find $install -type f -name '*.zip' -exec ls -l \{\} \; ;;
86 str) find $fs -type f \( -name '*.so*' -o -name '*.a' -o -name '*.pyc' -o -name '*.pyo' \
87 -o -name '.packlist' -o -name '*.pm' -o -name '*.pl' -o -name '*.pod' \) -exec ls -l \{\} \; ;;
88 esac | awk '{s+=$5}END{print s}'
89 }
92 # Query cache for already existing compressed file; substitute original file with the cached
93 # compressed one if so.
94 # $1: cache section (gz, mangz, png, etc.); $2: path to original file
96 query_cache() {
97 md5=$(md5sum "$2")
98 cachefile="$comp_cache_root/$1/${md5%% *}"
99 echo "$cachefile"
100 if [ -f "$cachefile" ]; then
101 ln -f "$cachefile" "$2"
102 echo '+' >> "$cache_stat"
103 else
104 echo '-' >> "$cache_stat"
105 false
106 fi
107 }
110 # Store compressed file to the cache
111 # $1: path to cache entry to be stored; $2: path to compressed file to be stored
113 store_cache() {
114 mkdir -p "${1%/*}"
115 mv "$2" "$1"
116 ln "$1" "$2"
117 }
120 # Function to compress all man pages
121 # Compressing can be disabled with COOKOPTS="!manz"
123 compress_manpages() {
124 time0=$(get_time)
125 [ "${COOKOPTS/!manz/}" != "$COOKOPTS" ] && return
126 manpath="$install/usr/share/man"
127 [ -d "$manpath" ] || return
128 size0=$(sizes man); [ -z "$size0" ] && return
130 tpi advancecomp-static
132 action 'Compressing man pages...'
134 # We'll use only Gzip compression, so decompress other formats first
135 find $manpath -type f -name '*.bz2' -exec bunzip2 \{\} \;
136 find $manpath -type f -name '*.xz' -exec unxz \{\} \;
138 # Fast compress with gzip
139 find $manpath -type f ! -name '*.gz' -exec gzip \{\} \;
141 # Fix symlinks
142 for i in $(find $manpath -type l); do
143 dest=$(readlink $i | sed 's|\.[gbx]z2*$||')
144 link=$(echo $i | sed 's|\.[gbx]z2*$||')
145 rm $i; ln -s $dest.gz $link.gz
146 done
148 # Recompress with advdef (it can't compress, only recompress)
149 IFS=$'\n'
150 for i in $(find $manpath -type f); do
151 if ! cached_path=$(query_cache mangz "$i"); then
152 advdef -z4q "$i"
153 store_cache "$cached_path" "$i"
154 fi
155 done
157 comp_summary "$time0" "$size0" "$(sizes man)"
158 }
161 # Function to recompress all gzip archives
162 # Recompressing can be disabled with COOKOPTS="!gz"
164 recompress_gz() {
165 time0=$(get_time)
166 [ "${COOKOPTS/!gz/}" != "$COOKOPTS" ] && return
167 size0=$(sizes gz); [ -z "$size0" ] && return
169 tpi advancecomp-static
171 action 'Recompressing gzip files...'
173 # Recompress with advdef
174 IFS=$'\n'
175 for i in $(find $install -type f -name '*.gz' ! -path '*/share/man/*'); do
176 if ! cached_path=$(query_cache gz "$i"); then
177 advdef -z4q "$i"
178 store_cache "$cached_path" "$i"
179 fi
180 done
182 comp_summary "$time0" "$size0" "$(sizes gz)"
183 }
186 # Function to recompress all zip archives
187 # Recompressing can be disabled with COOKOPTS="!zip"
189 recompress_zip() {
190 time0=$(get_time)
191 [ "${COOKOPTS/!zip/}" != "$COOKOPTS" ] && return
192 size0=$(sizes zip); [ -z "$size0" ] && return
194 tpi advancecomp-static
196 action 'Recompressing zip files...'
198 # Recompress with advzip
199 IFS=$'\n'
200 for i in $(find $install -type f -name '*.zip'); do
201 if ! cached_path=$(query_cache zip "$i"); then
202 advzip -z3qk "$i" # -4 is more than 2 orders slower
203 store_cache "$cached_path" "$i"
204 fi
205 done
207 comp_summary "$time0" "$size0" "$(sizes zip)"
208 }
211 # Function used after compile_rules() to compress all png images
212 # Compressing can be disabled with COOKOPTS="!pngz"
214 compress_png() {
215 time0=$(get_time)
216 [ "${COOKOPTS/!pngz/}" != "$COOKOPTS" ] && return
217 size0=$(sizes png); [ -z "$size0" ] && return
219 use_pq=true
220 use_op=true
221 [ "${COOKOPTS/!pngquant/}" != "$COOKOPTS" ] && use_pq=false
222 [ "${COOKOPTS/!optipng/}" != "$COOKOPTS" ] && use_op=false
223 $use_pq && tpi pngquant-static
224 $use_op && tpi optipng-static
226 action 'Compressing png images...'
228 oplevel=$(echo $COOKOPTS | grep 'op[0-8]' | sed 's|.*op\([0-8]\).*|\1|')
229 [ -z "$oplevel" ] && oplevel='2'
231 cache_section="png$oplevel"
232 $use_pq && cache_section="${cache_section}p"
233 $use_op && cache_section="${cache_section}o"
235 [ "$oplevel" == '8' ] && oplevel='7 -zm1-9'
237 IFS=$'\n'
238 for i in $(find $install -type f -name '*.png'); do
239 unset IFS
240 if ! cached_path=$(query_cache $cache_section "$i"); then
241 $use_pq && pngquant -f --skip-if-larger --ext .png --speed 1 "$i"
242 $use_op && optipng -quiet -strip all -o$oplevel "$i"
243 store_cache "$cached_path" "$i"
244 fi
245 done
247 comp_summary "$time0" "$size0" "$(sizes png)"
248 }
251 # Function used after compile_rules() to compress all svg images
252 # Compressing can be disabled with COOKOPTS="!svgz"
254 compress_svg() {
255 time0=$(get_time)
256 [ "${COOKOPTS/!svgz/}" != "$COOKOPTS" ] && return
257 size0=$(sizes svg); [ -z "$size0" ] && return
259 tpi svgcleaner
261 action 'Compressing svg images...'
263 [ "${COOKOPTS/!svgextra/}" == "$COOKOPTS" ] &&
264 opts="--apply-transform-to-paths yes --coordinates-precision 1 --paths-coordinates-precision 1"
266 cleaner_log="$(mktemp)"
267 for i in $(IFS=$'\n' find $install -type f -name '*.svg'); do
268 out="$(unset IFS; svgcleaner "$i" "$i" --copy-on-error --quiet \
269 --multipass --remove-unresolved-classes no $opts 2>&1)"
270 [ -z "$out" ] || echo -e "$i:\n$out\n" >> "$cleaner_log"
271 done
273 comp_summary "$time0" "$size0" "$(sizes svg)"
275 if [ -s "$cleaner_log" ]; then
276 _ 'Cleaner warnings and errors:'
277 awk '{printf " %s\n", $0;}' "$cleaner_log"
278 echo
279 fi
280 rm "$cleaner_log"
281 }
284 # Function used after compile_rules() to shrink all *.ui and *.glade files:
285 # remove insignificant spaces and comments
286 # Compressing can be disabled with COOKOPTS="!uiz"
288 compress_ui() {
289 [ "${COOKOPTS/!uiz/}" != "$COOKOPTS" ] && return
290 [ -z "$(find $install -type f \( -name '*.ui' -o -name '*.glade' \) )" ] && return
292 tpi xmlstarlet
294 action 'Compressing ui files...'
296 size0=$(sizes xml)
297 time0=$(get_time)
298 temp_ui="$(mktemp)"
299 IFS=$'\n'
300 for ui in $(find $install -type f \( -name '*.ui' -o -name '*.glade' \) ); do
301 xmlstarlet c14n --without-comments "$ui" | xmlstarlet sel -B -t -c '*' > "$temp_ui"
302 cat "$temp_ui" > "$ui"
303 done
305 comp_summary "$time0" "$size0" "$(sizes xml)"
306 rm "$temp_ui"
307 }
310 # Get list of supported locales...
312 get_supported_locales() {
313 lpc='/slitaz-i18n/stuff/locale-pack.conf'
314 if [ -e "$WOK$lpc" ]; then
315 # ... from package in the local wok
316 . "$WOK$lpc"
317 else
318 # ... from Hg
319 temp_conf=$(mktemp)
320 wget -q -O $temp_conf -T 10 "http://hg.slitaz.org/wok/raw-file/tip$lpc"
321 if [ -s $temp_conf ]; then
322 . $temp_conf
323 else
324 # Give up and use hardcoded list
325 LOCALE_PACK="ar ca cs da de el en es fi fr hr hu id is it ja nb nl nn pl pt \
326 pt_BR ro ru sl sv tr uk zh_CN zh_TW"
327 fi
328 rm $temp_conf
329 fi
330 echo $LOCALE_PACK
331 }
334 # Fix common errors and warnings in the .desktop files
335 # Fixing can be disabled with COOKOPTS="!fixdesktops"
337 fix_desktop_files() {
338 [ "${COOKOPTS/!fixdesktops/}" != "$COOKOPTS" ] && return
339 deskpath="$install/usr/share/applications"
340 [ -d "$deskpath" ] || return
341 [ -z "$(find $deskpath -type f -name '*.desktop')" ] && return
343 size0=$(sizes des)
344 time0=$(get_time)
346 if [ -n "$QA" -a -z "$(which desktop-file-validate)" ]; then
347 tpi desktop-file-validate-static
348 fi
350 # The variable $LOCALE is set in cook.conf and may be overridden in the receipt.
351 # Default value is "" (empty). That means for us that we'll use the full
352 # list of supported locales here.
353 [ -z "$LOCALE" ] && LOCALE=$(get_supported_locales)
355 IFS=$'\n'
356 for desktop in $(find $deskpath -type f -name '*.desktop'); do
357 cp "$desktop" "$desktop.orig"
359 # Sort out .desktop file (is prerequisite to correct working of `fix-desktop-file`)
360 sdft "$desktop" -i
362 # Fix common errors in .desktop file
363 fix-desktop-file "$desktop"
365 # Strip unsupported locales from .desktop file
366 [ "${COOKOPTS/!i18nz/}" == "$COOKOPTS" ] &&
367 sdft "$desktop" -i -k "$LOCALE"
369 # Extra-strip
370 [ "${COOKOPTS/!extradesktops/}" == "$COOKOPTS" ] &&
371 sdft "$desktop" -i -g -x -tf -r 'Keywords*' -o
373 if [ -n "$QA" ]; then
374 # Check the rest of errors, warnings and tips
375 _ 'QA: Checking %s...' "$(basename $desktop)"
376 busybox diff "$desktop.orig" "$desktop"
377 desktop-file-validate "$desktop" | busybox fold -s
378 echo
379 fi
381 rm "$desktop.orig"
382 done
384 comp_summary "$time0" "$size0" "$(sizes des)"
385 }
388 # Normalize all *.mo files: unconditionally convert to UTF-8; remove strings that are not really necessary
389 # to the translation (msgid = msgstr)
390 # Normalization can be disabled with COOKOPTS="!monorm"
392 normalize_mo() {
393 [ "${COOKOPTS/!monorm/}" != "$COOKOPTS" ] && return
394 [ -z "$(find $install -type f -name '*.mo')" ] && return
396 # Gettext functions: msgunfmt, msguniq, msgconv, msgfmt
397 tpi gettext
398 # Gconv modules (convert to UTF-8)
399 tpi glibc-locale
401 action 'Normalizing mo files...'
403 size0=$(sizes mo1)
404 time0=$(get_time)
406 # Process all existing *.mo files
407 IFS=$'\n'
408 for mo in $(find "$install" -type f -name '*.mo'); do
409 tmpfile="$(mktemp)"
411 msgunfmt "$mo" | msguniq | msgconv -o "$tmpfile" -t 'UTF-8'
412 # add newline
413 echo >> "$tmpfile"
415 # get Plural-Forms
416 awk '
417 BEGIN { skip = ""; }
418 {
419 if (! skip) {
420 s = $0;
421 gsub(/^[^\"]*\"/, "", s);
422 gsub(/\"$/, "", s);
423 printf("%s", s);
424 }
425 if (! $0) skip = "yes";
426 }
427 ' "$tmpfile" | sed 's|\\n|\n|g' | grep "^Plural-Forms:" > "$tmpfile.pf"
429 if ! grep -q 'msgid_plural' "$tmpfile"; then
430 echo > "$tmpfile.pf"
431 fi
433 # main
434 awk -v pf="$(cat "$tmpfile.pf")" '
435 function clean() {
436 mode = msgctxt = msgid = msgid_plural = msgstr = msgstr0 = msgstr1 = msgstr2 = msgstr3 = msgstr4 = msgstr5 = "";
437 }
439 function getstring() {
440 # Skip unquoted words at the beginning (msgid, msgstr...) and get string from inside quotes
441 s = $0;
442 gsub(/^[^\"]*\"/, "", s);
443 gsub(/\"$/, "", s);
444 return s;
445 }
447 BEGIN {
448 printf("msgid \"\"\nmsgstr \"\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n");
449 if (pf)
450 printf("\"%s\\n\"\n", pf);
451 printf("\n");
452 skip = 1;
453 clean();
454 }
456 {
457 # Skip the entire header
458 if (!skip) {
459 if ($1 == "msgctxt" || $1 == "msgid" || $1 == "msgstr" || $1 == "msgid_plural")
460 mode = $1;
461 if ($1 == "msgstr[0]") mode = "msgstr0";
462 if ($1 == "msgstr[1]") mode = "msgstr1";
463 if ($1 == "msgstr[2]") mode = "msgstr2";
464 if ($1 == "msgstr[3]") mode = "msgstr3";
465 if ($1 == "msgstr[4]") mode = "msgstr4";
466 if ($1 == "msgstr[5]") mode = "msgstr5";
468 if (mode == "msgctxt") msgctxt = msgctxt getstring();
469 if (mode == "msgid") msgid = msgid getstring();
470 if (mode == "msgstr") msgstr = msgstr getstring();
471 if (mode == "msgid_plural") msgid_plural = msgid_plural getstring();
472 if (mode == "msgstr0") msgstr0 = msgstr0 getstring();
473 if (mode == "msgstr1") msgstr1 = msgstr1 getstring();
474 if (mode == "msgstr2") msgstr2 = msgstr2 getstring();
475 if (mode == "msgstr3") msgstr3 = msgstr3 getstring();
476 if (mode == "msgstr4") msgstr4 = msgstr4 getstring();
477 if (mode == "msgstr5") msgstr5 = msgstr5 getstring();
479 if (! $0) {
480 if (msgid != msgstr) {
481 if (msgctxt) printf("msgctxt \"%s\"\n", msgctxt);
482 printf("msgid \"%s\"\n", msgid);
483 if (msgid_plural) printf("msgid_plural \"%s\"\n", msgid_plural);
484 if (msgstr) printf("msgstr \"%s\"\n", msgstr);
485 if (msgstr0) printf("msgstr[0] \"%s\"\n", msgstr0);
486 if (msgstr1) printf("msgstr[1] \"%s\"\n", msgstr1);
487 if (msgstr2) printf("msgstr[2] \"%s\"\n", msgstr2);
488 if (msgstr3) printf("msgstr[3] \"%s\"\n", msgstr3);
489 if (msgstr4) printf("msgstr[4] \"%s\"\n", msgstr4);
490 if (msgstr5) printf("msgstr[5] \"%s\"\n", msgstr5);
491 printf("\n");
492 }
493 clean();
494 }
495 }
496 if ($0 == "") skip = "";
497 }
498 ' "$tmpfile" > "$tmpfile.awk"
500 msgfmt "$tmpfile.awk" -o "$tmpfile.mo"
502 if [ -s "$tmpfile.mo" ]; then
503 rm "$mo"; mv "$tmpfile.mo" "$mo"
504 else
505 _ 'Error processing %s' "$mo"
506 [ -e "$tmpfile.mo" ] && rm "$tmpfile.mo"
507 fi
509 # Clean
510 rm "$tmpfile" "$tmpfile.pf" "$tmpfile.awk"
511 done
513 comp_summary "$time0" "$size0" "$(sizes mo1)"
514 }
517 # Strip locale definitions: normalize whitespace and remove comments
518 # Stripping can be disabled with COOKOPTS="!locdef"
520 strip_locale_def() {
521 [ "${COOKOPTS/!locdef/}" != "$COOKOPTS" ] && return
522 [ ! -d "$install/usr/share/i18n/locales" ] && return
523 [ -z "$(find $install/usr/share/i18n/locales -type f)" ] && return
525 action 'Stripping locale definitions...'
526 size0=$(sizes loc)
527 time0=$(get_time)
529 for i in $(find $install/usr/share/i18n/locales -type f); do
530 sed -i 's| | |g; s| *| |g; s|^ ||; /^%/d' $i
531 done
533 comp_summary "$time0" "$size0" "$(sizes loc)"
534 }
537 # Find and strip: --strip-all (-s) or --strip-debug on static libs as well
538 # as removing unneeded files like in Python packages. Cross compiled binaries
539 # must be stripped with cross-tools aka $ARCH-slitaz-*-strip
540 # Stripping can be disabled with COOKOPTS="!strip"
542 strip_package() {
543 [ "${COOKOPTS/!strip/}" != "$COOKOPTS" ] && return
545 case "$ARCH" in
546 arm*|x86_64) export STRIP="$HOST_SYSTEM-strip" ;;
547 *) export STRIP='strip' ;;
548 esac
549 action 'Executing strip on all files...'
550 size0=0
551 size1=0
552 time0=$(get_time)
554 # Strip executable files
555 for dir in $fs/bin $fs/sbin $fs/usr/bin $fs/usr/sbin $fs/usr/games; do
556 if [ -d "$dir" ]; then
557 oldsize=$(find $dir -type f -exec ls -l '{}' \; | awk '{s+=$5}END{print s}')
558 find $dir -type f -exec $STRIP -s '{}' 2>/dev/null \;
559 newsize=$(find $dir -type f -exec ls -l '{}' \; | awk '{s+=$5}END{print s}')
560 size0=$((size0 + oldsize)); size1=$((size1 + newsize))
561 fi
562 done
564 oldsize=$(sizes str)
566 # Strip shared and static libraries
567 find $fs -name '*.so*' -exec $STRIP -s '{}' 2>/dev/null \;
568 find $fs -name '*.a' -exec $STRIP -d '{}' 2>/dev/null \;
570 # Nullify timestamps of files in ar archives
571 # Skip empty 8-byte archives (hi, musl-libc package)
572 whereami=$(pwd)
573 find $fs -name '*.a' -type f -size +8c | \
574 while read i; do
575 tempdir=$(mktemp -d); cd $tempdir
576 ar -x $i; ar -crD $(basename $i) *
577 mv -f $tempdir/$(basename $i) $i
578 rm -rf $tempdir
579 done
580 cd $whereami; unset whereami
582 # Remove Python *.pyc and *.pyo
583 find $fs -type f \( -name '*.pyc' -o -name '*.pyo' \) -delete 2>/dev/null
585 # Remove both with the empty subfolders:
586 # 1. Perl perllocal.pod and .packlist (unconditionally)
587 local perlfiles="$(find $fs -type f \( -name 'perllocal.pod' -o -name '.packlist' \))"
588 # 2. Perl *.pod (if not disabled)
589 [ "${COOKOPTS/!rmpod/}" == "$COOKOPTS" ] &&
590 perlfiles="$perlfiles $(find $fs -type f -name '*.pod')"
591 echo "$perlfiles" | xargs rm -f 2>/dev/null
592 echo "$perlfiles" | awk 'BEGIN{FS=OFS="/"}{$NF="";print}' | xargs rmdir -p 2>/dev/null
594 # Strip Perl files (*.pm and *.pl) from documentation inside (if not disabled)
595 [ "${COOKOPTS/!perlz/}" == "$COOKOPTS" ] &&
596 find $fs -type f \( -name '*.pm' -o -name '*.pl' \) -exec sed -i '/^=/,/^=cut/d' '{}' \;
598 newsize=$(sizes str)
600 comp_summary "$time0" "$((size0 + oldsize))" "$((size1 + newsize))"
601 }
604 # Strip unsupported locales (.mo files)
606 strip_mo_i18n() {
607 [ "${COOKOPTS/!i18nz/}" != "$COOKOPTS" ] && return
609 [ ! -d "$fs/usr/share/locale" ] && return
610 [ -z "$(find $fs/usr/share/locale -type f -name '*.mo')" ] && return
612 action 'Thin out translation files...'
613 size0=$(sizes mo2)
614 time0=$(get_time)
616 # The variable $LOCALE is set in cook.conf and may be overridden in the receipt.
617 # Default value is "" (empty). That means for us that we'll use the full
618 # list of supported locales here.
619 [ -z "$LOCALE" ] && LOCALE=$(get_supported_locales)
621 # Existing locales
622 elocales=" $(ls -1 "$fs/usr/share/locale" | tr '\n' ' ') "
624 # Thin out the list of existing locales. At the end there will be only locales that need
625 # deleting (and the garbage like '_AU', _US', '_BR' leaving from 'en_AU', 'en_US', 'pt_BR'...)
626 for keep_locale in $LOCALE; do
627 elocales=${elocales//$keep_locale}
628 done
630 # Remove the unsupported locales
631 for rem_locale in $elocales; do
632 [ -d "$fs/usr/share/locale/$rem_locale" ] &&
633 rm -r "$fs/usr/share/locale/$rem_locale"
634 done
636 comp_summary "$time0" "$size0" "$(sizes mo2)"
637 }
642 case $1 in
643 install)
644 # Compressors working in the $install
645 case "$ARCH" in
646 arm*) ;;
647 *)
648 recompress_gz
649 recompress_zip
650 compress_manpages
651 compress_png
652 compress_svg
653 compress_ui
654 ;;
655 esac
657 fix_desktop_files
658 normalize_mo
659 strip_locale_def
660 ;;
661 fs)
662 # Compressors working in the $fs
663 strip_package
664 strip_mo_i18n
665 ;;
666 esac
668 # Clean
669 rm "$cache_stat"
670 find $comp_cache_root -type f -links -2 -delete