wok view make-slitaz-icons/stuff/mksit.sh @ rev 18383

linux64-aufs: add 3.2.71 patch
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Sep 18 09:16:57 2015 +0200 (2015-09-18)
parents ad29119ff607
children 61fdfde9104b
line source
1 #!/bin/sh
2 # Make SliTaz icon theme
3 # Aleksej Bobylev <al.bobylev@gmail.com>, 2014-2015
4 # (Started in November 2014)
6 VERSION="150506"
8 . /lib/libtaz.sh
11 ### Functions ###
13 # Usage of utility
15 usage() {
16 cat <<EOT
17 $(basename $0), v. $VERSION
18 Make icon theme for SliTaz GNU/Linux
20 Usage:
21 $(basename $0) [OPTIONS ...]
23 Options:
24 -f <path> The path to the original theme from which the icons will be taken
25 Note that this folder contains the file index.theme
26 -t <path> The path where the folder with a new theme will created
27 Note that existing folder will be silently removed
28 -s <path> Path to icon substitution definitions. Where <path> can point to file
29 or to folder containing file <original theme name>.sub
30 -n 'name' The name of the new theme (default will be taken from -t path)
32 +is -is Whether to use Inkscape to convert svg icons to png (default: +is)
33 +op -op Whether to use Optipng to optimize png icons (default: +op)
34 +sl -sl Whether to replace the same icons by symlinks (default: +sl)
36 -opmax Maximal settings for Optipng (slow but save maximum bytes)
38 -nocolor Don't use color in the log
39 EOT
40 }
43 # Color output
44 colored() {
45 if [ "$color" == 'yes' ]; then
46 colorize $@
47 else
48 echo $2
49 fi
50 }
53 # Find icon (use pre-generated list of icon files)
55 findi() {
56 grep -e "/$1.png" -e "/$1.svg" $ICONSLIST
57 }
60 # Copy icon
62 c() {
63 for SIZE in $SIZES; do
64 FOUND=''
65 for ICON in $(echo "$@" | sed 's|\([^ ]*\)|& gnome-mime-& gnome-dev-&|'); do
66 FINDICON=$(findi $ICON | sed "s|$FROM||g" | grep -e "/$SIZE/" -e "/${SIZE}x$SIZE/")
68 if [ -n "$FINDICON" ]; then
69 if [ $(echo "$FINDICON" | wc -l) != "1" ]; then
70 # Multiple choice
71 if [ "$(md5sum $(echo "$FINDICON" | sed 's|^.*$|'$FROM'&|g') | awk '{print $1}' | sort | uniq | wc -l)" != "1" ]; then
72 # note: really different icons with different md5sum
73 colored 33 "? $1($SIZE): Multiple choice:"
74 echo "$FINDICON" | sed 's|^.*$| * &|g'
75 fi
76 FINDICON="$(echo "$FINDICON" | head -n1)"
77 fi
78 mkdir -p $TO/${SIZE}x${SIZE}/$CATEGORY
80 BASE_FINDICON="$(basename $FINDICON .png)"
81 BASE_FINDICON="$(basename $BASE_FINDICON .svg)"
83 if [ "$1" == "$BASE_FINDICON" ]; then
84 colored 32 "+ $1($SIZE)"
85 else
86 colored 34 "+ $1($SIZE) <= $(basename $FINDICON)"
87 fi
89 EXT=${FINDICON##*.}
90 cp -aL $FROM/$FINDICON $TO/${SIZE}x${SIZE}/$CATEGORY/$1.$EXT
92 FOUND='yes'
93 break
94 fi
95 done
96 if [ -z "$FOUND" ]; then
97 colored 31 "- $1($SIZE) NOT FOUND!"
98 fi
99 done
100 }
103 # Maybe copy stock icon
105 s() {
106 if [ "$BASED_ON" != "Faenza" ]; then
107 c $@
108 else
109 echo ". $1"
110 fi
111 }
114 # Return shortest line
116 shortest_line() {
117 S=$1; shift
118 for L in $@; do
119 [ "${#L}" -lt "${#S}" ] && S="$L"
120 done
121 echo "$S"
122 }
125 # Replace the same files by symlinks, $@ - list of identical files
127 make_symlinks() {
128 S=$(shortest_line $@)
129 for file in $@; do
130 [ "$S" != "$file" ] && ln -sf $S $file
131 done
132 }
135 # Calculate size in bytes
137 size() {
138 echo -n "size: "
139 find "$TO" -type f -exec stat -c %s {} \; | awk 'BEGIN{SUM=0}{SUM+=$1}END{print SUM}'
140 }
143 # Print out category
145 echo_cat() {
146 echo
147 colored 35 $CATEGORY
148 colored 35 $(echo -n $CATEGORY | tr -c '' '-')
149 }
155 case "$1" in
156 -h|--help) usage; exit 0 ;;
157 -V|--version) echo "$(basename $0) v. $VERSION"; exit 0 ;;
158 esac
161 # Default parameters:
163 IS='yes'; OP='yes'; SL='yes'; PNGOPT=''; SUBS=''; color='yes'
165 while [ "x$1" != "x" ]; do
166 case "$1" in
167 -f) FROM="$2"; shift; BASED_ON="$(basename ${FROM%/})" ;;
168 -t) TO="$2"; shift; NAME="$(basename ${TO%/})" ;;
169 -s) SUBS="$2"; shift; if [ -d "$SUBS" ]; then SUBS="${SUBS%/}/$BASED_ON.sub"; fi ;;
170 -n) NAME="$2"; shift ;;
171 -is) IS='no' ;;
172 +is) IS='yes' ;;
173 -op) OP='no' ;;
174 +op) OP='yes' ;;
175 -sl) SL='no' ;;
176 +sl) SL='yes' ;;
177 -opmax) PNGOPT="-o7 -zm1-9" ;;
178 -nocolor) color='no' ;;
179 esac
180 shift
181 done
183 if [ "x$FROM" == "x" -o "x$TO" == "x" ]; then
184 echo "There are no required parameters (-f or -t)!"; exit 1
185 fi
187 echo "Check components..."
188 if [ $IS == 'yes' ]; then
189 echo -n "Inkscape: "
190 if [ -x "$(which inkscape)" ]; then
191 echo "$(which inkscape)"
192 else
193 colored 31 "not found! Force '-is'"; IS='no'
194 fi
195 fi
196 if [ $OP == 'yes' ]; then
197 echo -n "Optipng: "
198 if [ -x "$(which optipng)" ]; then
199 echo "$(which optipng)"
200 else
201 colored 31 "not found! Force '-op'"; OP='no'
202 fi
203 fi
204 echo -n "Symlinks: "
205 if [ -x "$(which symlinks)" ]; then
206 echo "$(which symlinks)"
207 else
208 colored 31 "not found! Abort."; exit 1
209 fi
210 echo
212 echo "Options: Inkscape=\"$IS\" Optipng=\"$OP\" Symlinks=\"$SL\""
213 echo "From: \"$FROM\""
214 echo "To: \"$TO\""
215 echo "Subs: \"$SUBS\""
216 echo "Name: \"$NAME\""
217 echo
220 rm -rf $TO
222 # make files list
223 ICONSLIST=$(mktemp)
224 find $FROM -type f -o -type l > $ICONSLIST
230 #########################
231 # Standard Action Icons #
232 #########################
233 CATEGORY='actions'; SIZES='16'; echo_cat
235 c address-book-new
236 s application-exit dialog-close # gtk_stock 16,24 # elementary hack
237 c appointment-new
238 c call-start
239 c call-stop process-stop # elementary hack
240 c contact-new
241 s document-new # gtk_stock 16,24
242 s document-open # gtk_stock 16,24
243 s document-open-recent # gtk_stock 16,24
244 c document-page-setup
245 s document-print # gtk_stock 16,24
246 s document-print-preview # gtk_stock 16,24
247 s document-properties # gtk_stock 16,24
248 s document-revert # gtk_stock 16,24
249 s document-save # gtk_stock 16,24
250 s document-save-as document-save # gtk_stock 16,24 # elementary hack
251 c document-send document-export # elementary hack
252 s edit-clear remove # gtk_stock 16,24 # elementary hack
253 s edit-copy # gtk_stock 16,24
254 s edit-cut # gtk_stock 16,24
255 s edit-delete # gtk_stock 16,24
256 s edit-find # gtk_stock 16,24
257 s edit-find-replace edit-find # gtk_stock 16,24 # elementary hack
258 s edit-paste # gtk_stock 16,24
259 s edit-redo # gtk_stock 16,24
260 s edit-select-all # gtk_stock 16,24
261 s edit-undo # gtk_stock 16,24
262 c folder-new
263 s format-indent-less # gtk_stock 16,24
264 s format-indent-more # gtk_stock 16,24
265 s format-justify-center # gtk_stock 16,24
266 s format-justify-fill # gtk_stock 16,24
267 s format-justify-left # gtk_stock 16,24
268 s format-justify-right # gtk_stock 16,24
269 c format-text-direction-ltr
270 c format-text-direction-rtl
271 s format-text-bold # gtk_stock 16,24
272 s format-text-italic # gtk_stock 16,24
273 s format-text-underline # gtk_stock 16,24
274 s format-text-strikethrough # gtk_stock 16,24
275 s go-bottom # gtk_stock 16,24
276 s go-down # gtk_stock 16,24
277 s go-first # gtk_stock 16,24
278 s go-home # gtk_stock 16,24
279 s go-jump # gtk_stock 16,24
280 s go-last # gtk_stock 16,24
281 s go-next # gtk_stock 16,24
282 s go-previous # gtk_stock 16,24
283 s go-top # gtk_stock 16,24
284 s go-up # gtk_stock 16,24
285 s help-about # gtk_stock 16,24
286 s help-contents # gtk_stock 16,24
287 c help-faq help-hint # elementary hack
288 c insert-image
289 c insert-link
290 c insert-object
291 c insert-text
292 s list-add # gtk_stock 16,24
293 s list-remove # gtk_stock 16,24
294 c mail-forward
295 c mail-mark-important
296 c mail-mark-junk
297 c mail-mark-notjunk
298 c mail-mark-read
299 c mail-mark-unread
300 c mail-message-new
301 c mail-reply-all
302 c mail-reply-sender
303 c mail-send
304 c mail-send-receive
305 c media-eject list-remove # Matrilineare hack
306 s media-playback-pause # gtk_stock 16,24
307 s media-playback-start # gtk_stock 16,24
308 s media-playback-stop # gtk_stock 16,24
309 s media-record # gtk_stock 16,24
310 s media-seek-backward go-previous # gtk_stock 16,24 # Matrilineare hack
311 s media-seek-forward go-next # gtk_stock 16,24 # Matrilineare hack
312 s media-skip-backward # gtk_stock 16,24
313 s media-skip-forward # gtk_stock 16,24
314 c object-flip-horizontal
315 c object-flip-vertical
316 c object-rotate-left
317 c object-rotate-right
318 s process-stop # gtk_stock 16,24
319 c system-lock-screen lock # Matrilineare hack
320 c system-log-out contact-new # Matrilineare hack
321 s system-run # gtk_stock 16,24
322 c system-search find # Matrilineare hack
323 c system-reboot system-run # Matrilineare hack
324 c system-shutdown system-shutdown-panel # Matrilineare hack
325 s tools-check-spelling # gtk_stock 16,24
326 s view-fullscreen # gtk_stock 16,24
327 s view-refresh # gtk_stock 16,24
328 s view-restore # gtk_stock 16,24
329 s view-sort-ascending # gtk_stock 16,24
330 s view-sort-descending # gtk_stock 16,24
331 s window-close # gtk_stock 16,20,24
332 c window-new
333 s zoom-fit-best # gtk_stock 16,24
334 s zoom-in # gtk_stock 16,24
335 s zoom-original # gtk_stock 16,24
336 s zoom-out # gtk_stock 16,24
337 #---------------------------
338 # PCManFM panel and menu
339 c tab-new
340 c view-choose
341 c view-filter
342 c view-sidetree
344 c gtk-execute # LXPanel menu: run
345 c system-shutdown-panel-restart # LXPanel menu: logout
346 c gtk-close # Yad close button
347 c gtk-go-forward gtk-go-forward-ltr # tazbox tz Yad dialog
350 ############################
351 # Standard Animation Icons #
352 ############################
353 CATEGORY='animations'; SIZES='16'; echo_cat
355 c process-working
359 ##############################
360 # Standard Application Icons #
361 ##############################
362 CATEGORY='apps'; SIZES='16 48'; echo_cat
364 c accessories-calculator
365 c accessories-character-map
366 c accessories-dictionary
367 c accessories-text-editor
368 c help-browser
369 c multimedia-volume-control # audio-volume-high
370 c preferences-desktop-accessibility
371 c preferences-desktop-font
372 c preferences-desktop-keyboard # keyboard
373 c preferences-desktop-locale
374 c preferences-desktop-multimedia # applications-multimedia
375 c preferences-desktop-screensaver
376 c preferences-desktop-theme
377 c preferences-desktop-wallpaper
378 c system-file-manager
379 c system-software-install # synaptic
380 c system-software-update # update-notifier
381 c utilities-system-monitor
382 c utilities-terminal
383 #-------------------
384 c gcolor2 # gcolor2.desktop
385 c gnome-glchess # chess.desktop
386 c gpicview # gpicview.desktop
387 c tazcalc gnumeric # tazcalc.desktop
388 c alsaplayer gnome-audio # alsaplayer.desktop
389 c leafpad # leafpad.desktop
390 c midori # midori.desktop
391 c mtpaint # mtpaint.desktop
392 c xterm # xterm.desktop
393 c burn-box brasero # burn-box.desktop
394 c iso-image-burn # burn-iso.desktop
395 c system-log-out # lxde-logout.desktop
396 c sudoku gnome-sudoku # sudoku.desktop
397 c utilities-log-viewer # bootlog.desktop
398 c preferences-desktop-display # lxrandr.desktop
399 c tazbug bug-buddy # tazbug.desktop
400 c applets-screenshooter # mtpaint-grab.desktop
401 c tazwikiss zim # tazwikiss.desktop
402 c system-software-installer # tazpanel-pkgs.desktop
403 c session-properties # lxsession-edit.desktop
404 c terminal # sakura.desktop
405 c user_auth # passwd.desktop
406 c preferences-system-time # tazbox-tz.desktop
407 c text-editor # vi.desktop
408 c drive-harddisk-usb # tazusb-box.desktop
409 c drive-optical # tazlito-wiz.desktop
410 c network-wireless # wifi-box.desktop
411 c gparted # gparted.desktop
412 c epdfview acroread # epdfview.desktop
413 c menu-editor # libfm-pref-apps.desktop
414 c preferences-system-windows # obconf.desktop
415 c twitter # twitter.desktop
416 c network-server # httpd.desktop
417 c pcmanfm system-file-manager # pcmanfm.desktop
421 ###########################
422 # Standard Category Icons #
423 ###########################
424 CATEGORY='categories'; SIZES='16 48'; echo_cat
426 c applications-accessories
427 c applications-development
428 c applications-engineering
429 c applications-games
430 c applications-graphics eog # Matrilineare hack
431 c applications-internet web-browser # Matrilineare hack
432 c applications-multimedia
433 c applications-office
434 c applications-other
435 c applications-science
436 c applications-system
437 c applications-utilities
438 c preferences-desktop
439 c preferences-desktop-peripherals
440 c preferences-desktop-personal
441 c preferences-other
442 c preferences-system
443 c preferences-system-network
444 c system-help
448 #########################
449 # Standard Device Icons #
450 #########################
451 CATEGORY='devices'; SIZES='16'; echo_cat
453 c audio-card
454 c audio-input-microphone
455 c battery
456 c camera-photo
457 c camera-video
458 c camera-web
459 c computer
460 c drive-harddisk
461 c drive-optical
462 c drive-removable-media drive-harddisk-removable # Matrilineare hack
463 c input-gaming
464 c input-keyboard
465 c input-mouse
466 c input-tablet
467 c media-flash
468 s media-floppy # gtk_stock 16,24
469 s media-optical drive-optical # gtk_stock 16,24 # Matrilineare hack
470 c media-tape
471 c modem
472 c multimedia-player
473 c network-wired
474 c network-wireless
475 c pda
476 c phone
477 c printer
478 c scanner
479 c video-display
480 #---------------------------
481 c camera camera-photo # Matrilineare hack
483 # Big drive icons on the PCManFM Desktop
484 SIZES='48'
485 c drive-harddisk
486 c drive-optical
487 c drive-removable-media drive-harddisk-removable # Matrilineare hack
491 #########################
492 # Standard Emblem Icons #
493 #########################
494 CATEGORY='emblems'; SIZES='16'; echo_cat
496 c emblem-default
497 c emblem-documents x-office-document # Matrilineare hack
498 c emblem-downloads
499 c emblem-favorite
500 c emblem-important
501 c emblem-mail
502 c emblem-photos
503 c emblem-readonly
504 c emblem-shared
505 c emblem-symbolic-link
506 c emblem-synchronized
507 c emblem-system
508 c emblem-unreadable
512 ##########################
513 # Standard Emotion Icons #
514 ##########################
515 CATEGORY='emotions'; SIZES='16'; echo_cat
517 c face-angel
518 c face-angry
519 c face-cool
520 c face-crying
521 c face-devilish
522 c face-embarrassed
523 c face-kiss
524 c face-laugh
525 c face-monkey
526 c face-plain
527 c face-raspberry
528 c face-sad
529 c face-sick
530 c face-smile
531 c face-smile-big
532 c face-smirk
533 c face-surprise
534 c face-tired
535 c face-uncertain
536 c face-wink
537 c face-worried
541 ################################
542 # Standard International Icons #
543 ################################
545 #flag-aa
546 #flag-RU
547 #flag-UA
551 ############################
552 # Standard MIME Type Icons #
553 ############################
554 CATEGORY='mimetypes'; SIZES='48 16'; echo_cat
555 A='application'
557 # generic icons described in the /usr/share/mime/packages/freedesktop.org.xml
558 c application-x-executable
559 c audio-x-generic
560 c font-x-generic
561 c image-x-generic
562 c package-x-generic
563 c text-html
564 c text-x-generic # gtk_stock 16,24 but...
565 c text-x-generic-template
566 c text-x-script
567 c video-x-generic
568 c x-office-address-book
569 c x-office-calendar
570 c x-office-document
571 c x-office-presentation
572 c x-office-spreadsheet
573 #--------------------------------------
574 # special types
575 c $A-octet-stream
576 c $A-x-zerosize
578 # archives
579 c $A-gzip
580 c $A-x-compressed-tar
581 c $A-x-7z-compressed
582 c $A-x-ace
583 c $A-x-arc
584 c $A-x-archive
585 c $A-x-rar
586 c $A-x-tar
587 c $A-zip
588 c $A-vnd.ms-cab-compressed
589 c $A-x-alz
590 c $A-x-arj
591 c $A-x-bcpio
592 c $A-x-bzip
593 c $A-x-bzip-compressed-tar
594 c $A-x-lha
595 c $A-x-lzma
596 c $A-x-lzma-compressed-tar
597 c $A-x-lzop
598 c $A-x-tzo
599 c $A-x-xar
600 c $A-x-xz
601 c $A-x-xz-compressed-tar
603 # packages
604 c $A-vnd.android.package-archive
605 c $A-x-deb
606 c $A-x-java-archive
607 c $A-x-rpm
608 c $A-x-source-rpm $A-x-rpm
609 c $A-x-tazpkg
611 c $A-illustrator
612 c $A-javascript
613 c $A-mbox
614 c $A-pdf
615 c $A-pgp-signature
616 c $A-rtf
617 c $A-x-apple-diskimage $A-x-cd-image
618 c $A-x-cbr
619 c $A-x-cd-image
620 c $A-x-core
621 c $A-x-designer
622 c $A-x-desktop
624 c $A-x-theme
625 c $A-x-emerald-theme $A-x-theme
626 c $A-x-openbox-theme $A-x-theme
628 c $A-x-generic
629 c $A-x-object
630 c $A-x-sharedlib
632 c $A-x-gettext-translation
633 c text-x-gettext-translation
634 c text-x-gettext-translation-template
636 c $A-x-gtk-builder
637 c $A-x-m4
638 c $A-xml
639 c $A-x-ms-dos-executable
641 c $A-x-perl
642 c $A-x-python-bytecode
643 c $A-x-shellscript
644 c $A-x-sqlite3
645 c $A-x-trash
646 c $A-x-x509-ca-cert
648 c audio-mpeg
649 c audio-x-vorbis+ogg
650 c audio-x-wav
651 c image-x-eps
652 c image-x-xcursor
653 c inode-blockdevice block-device
654 c inode-chardevice chardevice
655 c inode-directory
656 c inode-mount-point
657 c inode-symlink
658 c inode-x-generic
659 c text-css
660 c text-plain
661 c text-richtext
662 c text-x-authors
663 c text-x-changelog
664 c text-x-chdr
665 c text-x-copying
666 c text-x-csrc
667 c text-x-install
668 c text-x-log
669 c text-x-makefile
670 c text-x-markdown
671 c text-x-patch
672 c text-x-python
673 c text-x-readme
674 c text-x-tazpkg-receipt text-x-script
678 ########################
679 # Standard Place Icons #
680 ########################
681 CATEGORY='places'; SIZES='16 48'; echo_cat
683 c folder # gtk_stock 16,24
684 c folder-remote # gtk_stock 16,24
685 c network-server
686 c network-workgroup
687 c start-here
688 c user-bookmarks
689 c user-desktop # gtk_stock 16,24
690 c user-home # gtk_stock 16,24
691 c user-trash
692 #------------------
693 # PCManFM XDG home sub-folders
694 c folder-documents
695 c folder-download
696 c folder-music
697 c folder-pictures
698 c folder-publicshare
699 c folder-templates
700 c folder-videos
704 #########################
705 # Standard Status Icons #
706 #########################
707 CATEGORY='status'; SIZES='22'; echo_cat
709 c appointment-missed
710 c appointment-soon
711 c audio-volume-high # gtk_stock 24
712 c audio-volume-low # gtk_stock 24
713 c audio-volume-medium # gtk_stock 24
714 c audio-volume-muted # gtk_stock 24
715 c battery-caution
716 c battery-low
717 c dialog-error # gtk_stock 48
718 c dialog-information # gtk_stock 16,24,48
719 c dialog-password # gtk_stock 48
720 c dialog-question # gtk_stock 48
721 c dialog-warning # gtk_stock 48
722 c folder-drag-accept
723 c folder-open
724 c folder-visiting
725 c image-loading
726 c image-missing # gtk_stock 16,24
727 c mail-attachment
728 c mail-unread
729 c mail-read
730 c mail-replied
731 c mail-signed
732 c mail-signed-verified
733 c media-playlist-repeat
734 c media-playlist-shuffle
735 c network-error
736 c network-idle # gtk_stock 16,24
737 c network-offline
738 c network-receive
739 c network-transmit
740 c network-transmit-receive
741 c printer-error # gtk_stock 16,24
742 c printer-printing
743 c security-high
744 c security-medium
745 c security-low
746 c software-update-available
747 c software-update-urgent
748 c sync-error
749 c sync-synchronizing
750 c task-due
751 c task-past-due
752 c user-available
753 c user-away
754 c user-idle
755 c user-offline
756 #c user-trash-full
757 c weather-clear
758 c weather-clear-night
759 c weather-few-clouds
760 c weather-few-clouds-night
761 c weather-fog
762 c weather-overcast
763 c weather-severe-alert
764 c weather-showers
765 c weather-showers-scattered
766 c weather-snow
767 c weather-storm
768 #------------------
769 c system-shutdown-restart-panel # LXPanel logout icon (slitaz-logout.desktop)
771 SIZES="48 16"
772 c user-trash-full # PCManFM desktop
773 c dialog-password # tazbox su default icon
774 c dialog-error # tazbox su error icon
775 c dialog-information
776 c dialog-password
777 c dialog-question
778 c dialog-warning
780 # LXPanel status icons
781 SIZES="22"
782 c gnome-netstatus-0-24 nm-signal-25
783 c gnome-netstatus-25-49 nm-signal-50
784 c gnome-netstatus-50-74 nm-signal-75
785 c gnome-netstatus-75-100 nm-signal-100
786 c gnome-netstatus-disconn network-error
787 c gnome-netstatus-error network-error
788 c gnome-netstatus-idle network-idle
789 c gnome-netstatus-rx network-receive
790 c gnome-netstatus-tx network-transmit
791 c gnome-netstatus-txrx network-transmit-receive
797 #####
799 echo -n "Original "; size
801 #####
803 if [ "$IS" == "yes" ]; then
804 echo -n "Inkscape... "
805 # convert svg to png
806 # rarely inkscape may fail, good that we leave original file
807 find $TO -type f -iname '*.svg' \( -exec sh -c "export E={}; inkscape -z -f \$E -e \${E%svg}png" \; -exec rm {} \; \)
808 size
809 fi
811 #####
813 if [ "$OP" == "yes" ]; then
814 echo -n "Optipng... "
815 # re-compress png files
816 find $TO -type f -iname '*.png' -exec optipng -quiet -strip all $PNGOPT {} \;
817 size
818 fi
820 #####
822 if [ "$SL" == "yes" ]; then
823 echo -n "Symlinks... "
824 MD5FILE=$(mktemp); find $TO -type f -exec md5sum {} \; | sort > $MD5FILE
825 # substitute repeated files by symlinks
826 for md in $(uniq -d -w32 $MD5FILE | cut -c1-32); do
827 make_symlinks $(grep $md $MD5FILE | cut -c35-)
828 done
829 rm "$MD5FILE"
830 # make all symlinks relative
831 SL=$(symlinks -crs $TO 2> /dev/null)
832 size
833 fi
835 #####
837 echo -n 'Make index.theme... '
838 {
839 echo "[Icon Theme]"
840 echo "Name=$NAME"
842 echo -n "Directories="
843 cd "$TO"
844 FOLDERS=$(find . -type d -mindepth 2 | sort | sed "s|^\./||g")
845 FOLDERS_COMMA=$(echo "$FOLDERS" | tr '\n' ',')
846 echo ${FOLDERS_COMMA%,}
848 for FOLDER in $FOLDERS; do
849 echo
850 echo "[$FOLDER]"
851 echo -n "Size="; echo "$FOLDER" | sed 's|^\([0-9]*\).*|\1|'
852 echo -n "Context="
853 case ${FOLDER#*/} in
854 actions) echo 'Actions' ;;
855 animations) echo 'Animations' ;;
856 apps) echo 'Applications' ;;
857 categories) echo 'Categories' ;;
858 devices) echo 'Devices' ;;
859 emblems) echo 'Emblems' ;;
860 emotes) echo 'Emotes' ;;
861 filesystems) echo 'FileSystems' ;;
862 intl) echo 'International' ;;
863 mimetypes) echo 'MimeTypes' ;;
864 places) echo 'Places' ;;
865 status) echo 'Status' ;;
866 *) echo 'Other' ;;
867 esac
868 echo "Type=Threshold"
869 done
870 } > $TO/index.theme
871 echo 'Done'