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

Add: get-vivaldi, kazehakase. Up: firefox-official(42.0). Misc: change various icons.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Sat Nov 07 03:08:19 2015 +0200 (2015-11-07)
parents 61fdfde9104b
children b2ba8b3680f1
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="151106"
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 preferences-desktop
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
348 c bookmark-new # Midori
351 ############################
352 # Standard Animation Icons #
353 ############################
354 CATEGORY='animations'; SIZES='16'; echo_cat
356 c process-working
360 ##############################
361 # Standard Application Icons #
362 ##############################
363 CATEGORY='apps'; SIZES='16 48'; echo_cat
365 c accessories-calculator
366 c accessories-character-map
367 c accessories-dictionary
368 c accessories-text-editor
369 c help-browser
370 c multimedia-volume-control # audio-volume-high
371 c preferences-desktop-accessibility
372 c preferences-desktop-font
373 c preferences-desktop-keyboard # keyboard
374 c preferences-desktop-locale
375 c preferences-desktop-multimedia # applications-multimedia
376 c preferences-desktop-screensaver
377 c preferences-desktop-theme
378 c preferences-desktop-wallpaper
379 c system-file-manager
380 c system-software-install # synaptic
381 c system-software-update # update-notifier
382 c utilities-system-monitor
383 c utilities-terminal
384 #-------------------
385 c gcolor2 # gcolor2.desktop
386 c gnome-glchess # chess.desktop
387 c gpicview # gpicview.desktop
388 c tazcalc gnumeric # tazcalc.desktop
389 c alsaplayer gnome-audio # alsaplayer.desktop
390 c leafpad # leafpad.desktop
391 c midori # midori.desktop
392 c mtpaint # mtpaint.desktop
393 c xterm # xterm.desktop
394 c burn-box brasero # burn-box.desktop
395 c iso-image-burn # burn-iso.desktop
396 c system-log-out # lxde-logout.desktop
397 c sudoku gnome-sudoku # sudoku.desktop
398 c utilities-log-viewer # bootlog.desktop
399 c preferences-desktop-display # lxrandr.desktop
400 c tazbug bug-buddy # tazbug.desktop
401 c applets-screenshooter # mtpaint-grab.desktop
402 c tazwikiss zim # tazwikiss.desktop
403 c system-software-installer # tazpanel-pkgs.desktop
404 c session-properties # lxsession-edit.desktop
405 c terminal # sakura.desktop
406 c user_auth # passwd.desktop
407 c preferences-system-time # tazbox-tz.desktop
408 c text-editor # vi.desktop
409 c drive-harddisk-usb # tazusb-box.desktop
410 c drive-optical # tazlito-wiz.desktop
411 c network-wireless # wifi-box.desktop
412 c gparted # gparted.desktop
413 c epdfview acroread # epdfview.desktop
414 c menu-editor # libfm-pref-apps.desktop
415 c preferences-system-windows # obconf.desktop
416 c twitter # twitter.desktop
417 c network-server # httpd.desktop
418 c pcmanfm system-file-manager # pcmanfm.desktop
422 ###########################
423 # Standard Category Icons #
424 ###########################
425 CATEGORY='categories'; SIZES='16 48'; echo_cat
427 c applications-accessories
428 c applications-development
429 c applications-engineering
430 c applications-games
431 c applications-graphics eog # Matrilineare hack
432 c applications-internet web-browser # Matrilineare hack
433 c applications-multimedia
434 c applications-office
435 c applications-other
436 c applications-science
437 c applications-system
438 c applications-utilities
439 c preferences-desktop
440 c preferences-desktop-peripherals
441 c preferences-desktop-personal
442 c preferences-other
443 c preferences-system
444 c preferences-system-network
445 c system-help
449 #########################
450 # Standard Device Icons #
451 #########################
452 CATEGORY='devices'; SIZES='16'; echo_cat
454 c audio-card
455 c audio-input-microphone
456 c battery
457 c camera-photo
458 c camera-video
459 c camera-web
460 c computer
461 c drive-harddisk
462 c drive-optical
463 c drive-removable-media drive-harddisk-removable # Matrilineare hack
464 c input-gaming
465 c input-keyboard
466 c input-mouse
467 c input-tablet
468 c media-flash
469 s media-floppy # gtk_stock 16,24
470 s media-optical drive-optical # gtk_stock 16,24 # Matrilineare hack
471 c media-tape
472 c modem
473 c multimedia-player
474 c network-wired
475 c network-wireless
476 c pda
477 c phone
478 c printer
479 c scanner
480 c video-display
481 #---------------------------
482 c camera camera-photo # Matrilineare hack
484 # Big drive icons on the PCManFM Desktop
485 SIZES='48'
486 c drive-harddisk
487 c drive-optical
488 c drive-removable-media drive-harddisk-removable # Matrilineare hack
492 #########################
493 # Standard Emblem Icons #
494 #########################
495 CATEGORY='emblems'; SIZES='16'; echo_cat
497 c emblem-default
498 c emblem-documents x-office-document # Matrilineare hack
499 c emblem-downloads
500 c emblem-favorite
501 c emblem-important
502 c emblem-mail
503 c emblem-photos
504 c emblem-readonly
505 c emblem-shared
506 c emblem-symbolic-link
507 c emblem-synchronized
508 c emblem-system
509 c emblem-unreadable
513 ##########################
514 # Standard Emotion Icons #
515 ##########################
516 CATEGORY='emotions'; SIZES='16'; echo_cat
518 c face-angel
519 c face-angry
520 c face-cool
521 c face-crying
522 c face-devilish
523 c face-embarrassed
524 c face-kiss
525 c face-laugh
526 c face-monkey
527 c face-plain
528 c face-raspberry
529 c face-sad
530 c face-sick
531 c face-smile
532 c face-smile-big
533 c face-smirk
534 c face-surprise
535 c face-tired
536 c face-uncertain
537 c face-wink
538 c face-worried
542 ################################
543 # Standard International Icons #
544 ################################
546 #flag-aa
547 #flag-RU
548 #flag-UA
552 ############################
553 # Standard MIME Type Icons #
554 ############################
555 CATEGORY='mimetypes'; SIZES='48 16'; echo_cat
556 A='application'
558 # generic icons described in the /usr/share/mime/packages/freedesktop.org.xml
559 c application-x-executable
560 c audio-x-generic
561 c font-x-generic
562 c image-x-generic
563 c package-x-generic
564 c text-html
565 c text-x-generic # gtk_stock 16,24 but...
566 c text-x-generic-template
567 c text-x-script
568 c video-x-generic
569 c x-office-address-book
570 c x-office-calendar
571 c x-office-document
572 c x-office-presentation
573 c x-office-spreadsheet
574 #--------------------------------------
575 # special types
576 c $A-octet-stream
577 c $A-x-zerosize
579 # archives
580 c $A-gzip
581 c $A-x-compressed-tar
582 c $A-x-7z-compressed
583 c $A-x-ace
584 c $A-x-arc
585 c $A-x-archive
586 c $A-x-rar
587 c $A-x-tar
588 c $A-zip
589 c $A-vnd.ms-cab-compressed
590 c $A-x-alz
591 c $A-x-arj
592 c $A-x-bcpio
593 c $A-x-bzip
594 c $A-x-bzip-compressed-tar
595 c $A-x-lha
596 c $A-x-lzma
597 c $A-x-lzma-compressed-tar
598 c $A-x-lzop
599 c $A-x-tzo
600 c $A-x-xar
601 c $A-x-xz
602 c $A-x-xz-compressed-tar
604 # packages
605 c $A-vnd.android.package-archive
606 c $A-x-deb
607 c $A-x-java-archive
608 c $A-x-rpm
609 c $A-x-source-rpm $A-x-rpm
610 c $A-x-tazpkg
612 c $A-illustrator
613 c $A-javascript
614 c $A-mbox
615 c $A-pdf
616 c $A-pgp-signature
617 c $A-rtf
618 c $A-x-apple-diskimage $A-x-cd-image
619 c $A-x-cbr
620 c $A-x-cd-image
621 c $A-x-core
622 c $A-x-designer
623 c $A-x-desktop
625 c $A-x-theme
626 c $A-x-emerald-theme $A-x-theme
627 c $A-x-openbox-theme $A-x-theme
629 c $A-x-generic
630 c $A-x-object
631 c $A-x-sharedlib
633 c $A-x-gettext-translation
634 c text-x-gettext-translation
635 c text-x-gettext-translation-template
637 c $A-x-gtk-builder
638 c $A-x-m4
639 c $A-xml
640 c $A-x-ms-dos-executable
642 c $A-x-perl
643 c $A-x-python-bytecode
644 c $A-x-shellscript
645 c $A-x-sqlite3
646 c $A-x-trash
647 c $A-x-x509-ca-cert
649 c audio-mpeg
650 c audio-x-vorbis+ogg
651 c audio-x-wav
652 c image-x-eps
653 c image-x-xcursor
654 c inode-blockdevice block-device
655 c inode-chardevice chardevice
656 c inode-directory
657 c inode-mount-point
658 c inode-symlink
659 c inode-x-generic
660 c text-css
661 c text-plain
662 c text-richtext
663 c text-x-authors
664 c text-x-changelog
665 c text-x-chdr
666 c text-x-copying
667 c text-x-csrc
668 c text-x-install
669 c text-x-log
670 c text-x-makefile
671 c text-x-markdown
672 c text-x-patch
673 c text-x-python
674 c text-x-readme
675 c text-x-tazpkg-receipt text-x-script
677 c application-x-shockwave-flash # Midori
680 ########################
681 # Standard Place Icons #
682 ########################
683 CATEGORY='places'; SIZES='16 48'; echo_cat
685 c folder # gtk_stock 16,24
686 c folder-remote # gtk_stock 16,24
687 c network-server
688 c network-workgroup
689 c start-here
690 c user-bookmarks
691 c user-desktop # gtk_stock 16,24
692 c user-home # gtk_stock 16,24
693 c user-trash
694 #------------------
695 # PCManFM XDG home sub-folders
696 c folder-documents
697 c folder-download
698 c folder-music
699 c folder-pictures
700 c folder-publicshare
701 c folder-templates
702 c folder-videos
706 #########################
707 # Standard Status Icons #
708 #########################
709 CATEGORY='status'; SIZES='22'; echo_cat
711 c appointment-missed
712 c appointment-soon
713 c audio-volume-high # gtk_stock 24
714 c audio-volume-low # gtk_stock 24
715 c audio-volume-medium # gtk_stock 24
716 c audio-volume-muted # gtk_stock 24
717 c battery-caution
718 c battery-low
719 c dialog-error # gtk_stock 48
720 c dialog-information # gtk_stock 16,24,48
721 c dialog-password # gtk_stock 48
722 c dialog-question # gtk_stock 48
723 c dialog-warning # gtk_stock 48
724 c folder-drag-accept
725 c folder-open
726 c folder-visiting
727 c image-loading
728 c image-missing # gtk_stock 16,24
729 c mail-attachment
730 c mail-unread
731 c mail-read
732 c mail-replied
733 c mail-signed
734 c mail-signed-verified
735 c media-playlist-repeat
736 c media-playlist-shuffle
737 c network-error
738 c network-idle # gtk_stock 16,24
739 c network-offline
740 c network-receive
741 c network-transmit
742 c network-transmit-receive
743 c printer-error # gtk_stock 16,24
744 c printer-printing
745 c security-high
746 c security-medium
747 c security-low
748 c software-update-available
749 c software-update-urgent
750 c sync-error
751 c sync-synchronizing
752 c task-due
753 c task-past-due
754 c user-available
755 c user-away
756 c user-idle
757 c user-offline
758 #c user-trash-full
759 c weather-clear
760 c weather-clear-night
761 c weather-few-clouds
762 c weather-few-clouds-night
763 c weather-fog
764 c weather-overcast
765 c weather-severe-alert
766 c weather-showers
767 c weather-showers-scattered
768 c weather-snow
769 c weather-storm
770 #------------------
771 c system-shutdown-restart-panel # LXPanel logout icon (slitaz-logout.desktop)
773 SIZES="48 16"
774 c user-trash-full # PCManFM desktop
775 c dialog-password # tazbox su default icon
776 c dialog-error # tazbox su error icon
777 c dialog-information
778 c dialog-password
779 c dialog-question
780 c dialog-warning
782 # LXPanel status icons
783 SIZES="22"
784 c gnome-netstatus-0-24 nm-signal-25
785 c gnome-netstatus-25-49 nm-signal-50
786 c gnome-netstatus-50-74 nm-signal-75
787 c gnome-netstatus-75-100 nm-signal-100
788 c gnome-netstatus-disconn network-error
789 c gnome-netstatus-error network-error
790 c gnome-netstatus-idle network-idle
791 c gnome-netstatus-rx network-receive
792 c gnome-netstatus-tx network-transmit
793 c gnome-netstatus-txrx network-transmit-receive
799 #####
801 echo -n "Original "; size
803 #####
805 if [ "$IS" == "yes" ]; then
806 echo -n "Inkscape... "
807 # convert svg to png
808 # rarely inkscape may fail, good that we leave original file
809 find $TO -type f -iname '*.svg' \( -exec sh -c "export E={}; inkscape -z -f \$E -e \${E%svg}png" \; -exec rm {} \; \)
810 size
811 fi
813 #####
815 if [ "$OP" == "yes" ]; then
816 echo -n "Optipng... "
817 # re-compress png files
818 find $TO -type f -iname '*.png' -exec optipng -quiet -strip all $PNGOPT {} \;
819 size
820 fi
822 #####
824 if [ "$SL" == "yes" ]; then
825 echo -n "Symlinks... "
826 MD5FILE=$(mktemp); find $TO -type f -exec md5sum {} \; | sort > $MD5FILE
827 # substitute repeated files by symlinks
828 for md in $(uniq -d -w32 $MD5FILE | cut -c1-32); do
829 make_symlinks $(grep $md $MD5FILE | cut -c35-)
830 done
831 rm "$MD5FILE"
832 # make all symlinks relative
833 SL=$(symlinks -crs $TO 2> /dev/null)
834 size
835 fi
837 #####
839 echo -n 'Make index.theme... '
840 {
841 echo "[Icon Theme]"
842 echo "Name=$NAME"
844 echo -n "Directories="
845 cd "$TO"
846 FOLDERS=$(find . -type d -mindepth 2 | sort | sed "s|^\./||g")
847 FOLDERS_COMMA=$(echo "$FOLDERS" | tr '\n' ',')
848 echo ${FOLDERS_COMMA%,}
850 for FOLDER in $FOLDERS; do
851 echo
852 echo "[$FOLDER]"
853 echo -n "Size="; echo "$FOLDER" | sed 's|^\([0-9]*\).*|\1|'
854 echo -n "Context="
855 case ${FOLDER#*/} in
856 actions) echo 'Actions' ;;
857 animations) echo 'Animations' ;;
858 apps) echo 'Applications' ;;
859 categories) echo 'Categories' ;;
860 devices) echo 'Devices' ;;
861 emblems) echo 'Emblems' ;;
862 emotes) echo 'Emotes' ;;
863 filesystems) echo 'FileSystems' ;;
864 intl) echo 'International' ;;
865 mimetypes) echo 'MimeTypes' ;;
866 places) echo 'Places' ;;
867 status) echo 'Status' ;;
868 *) echo 'Other' ;;
869 esac
870 echo "Type=Threshold"
871 done
872 } > $TO/index.theme
873 echo 'Done'