Debian Codegraph @

cursors-src/bloom-fantacy/build.sh

raw
1 #!/bin/bash
2 # Open initial output.
3 # Prefer konsole if its there, otherwise fall back to xterminal.
4 #tty -s; if [ $? -ne 0 ]; then
5 # if command -v konsole &>/dev/null; then
6 # konsole -e "$0"; exit;
7 # else
8 # xterm -e "$0"; exit;
9 # fi
10 #fi
11
12 cd "$( dirname "${BASH_SOURCE[0]}" )"
13 RAWSVG="src/cursors.svg"
14 INDEX="src/cursor.theme"
15 ALIASES="src/cursorList"
16
17
18 echo -ne "Checking Requirements...\\r"
19 if [ ! -f $RAWSVG ] ; then
20 echo -e "\\nFAIL: '$RAWSVG' missing in /src"
21 exit 1
22 fi
23
24 if [ ! -f $INDEX ] ; then
25 echo -e "\\nFAIL: '$INDEX' missing in /src"
26 exit 1
27 fi
28
29 if ! type "inkscape" > /dev/null ; then
30 echo -e "\\nFAIL: inkscape must be installed"
31 exit 1
32 fi
33
34 if ! type "xcursorgen" > /dev/null ; then
35 echo -e "\\nFAIL: xcursorgen must be installed"
36 exit 1
37 fi
38 echo -e "Checking Requirements... DONE"
39
40
41
42 echo -ne "Making Folders... $BASENAME\\r"
43 DIR2X="build/x2"
44 DIR1_5X="build/x1_5"
45 DIR1X="build/x1"
46 OUTPUT="$(grep --only-matching --perl-regex "(?<=Name\=).*$" $INDEX)"
47 OUTPUT=../../${OUTPUT// /_}
48 mkdir -p "$DIR2X"
49 mkdir -p "$DIR1_5X"
50 mkdir -p "$DIR1X"
51 mkdir -p "$OUTPUT/cursors"
52 echo 'Making Folders... DONE';
53
54
55
56 for CUR in src/config/*.cursor; do
57 BASENAME=$CUR
58 BASENAME=${BASENAME##*/}
59 BASENAME=${BASENAME%.*}
60
61 echo -ne "\033[0KGenerating simple cursor pixmaps... $BASENAME\\r"
62
63 if [ "$DIR1X/$BASENAME.png" -ot $RAWSVG ] ; then
64 inkscape -i $BASENAME -d 96 -f $RAWSVG -e "$DIR1X/$BASENAME.png" > /dev/null
65 fi
66
67 if [ "$DIR1_5X/$BASENAME.png" -ot $RAWSVG ] ; then
68 inkscape -i $BASENAME -d 144 -f $RAWSVG -e "$DIR1_5X/$BASENAME.png" > /dev/null
69 fi
70
71 if [ "$DIR2X/$BASENAME.png" -ot $RAWSVG ] ; then
72 inkscape -i $BASENAME -d 192 -f $RAWSVG -e "$DIR2X/$BASENAME.png" > /dev/null
73 fi
74 done
75 echo -e "\033[0KGenerating simple cursor pixmaps... DONE"
76
77
78
79 for i in 01 02 03 04 05 06 07 08
80 do
81 echo -ne "\033[0KGenerating animated cursor pixmaps... $i / 8 \\r"
82
83 if [ "$DIR1X/progress-$i.png" -ot $RAWSVG ] ; then
84 inkscape -i progress-$i -d 96 -f $RAWSVG -e "$DIR1X/progress-$i.png" > /dev/null
85 fi
86
87 if [ "$DIR1_5X/progress-$i.png" -ot $RAWSVG ] ; then
88 inkscape -i progress-$i -d 144 -f $RAWSVG -e "$DIR1_5X/progress-$i.png" > /dev/null
89 fi
90
91 if [ "$DIR2X/progress-$i.png" -ot $RAWSVG ] ; then
92 inkscape -i progress-$i -d 192 -f $RAWSVG -e "$DIR2X/progress-$i.png" > /dev/null
93 fi
94
95 if [ "$DIR1X/wait-$i.png" -ot $RAWSVG ] ; then
96 inkscape -i wait-$i -d 96 -f $RAWSVG -e "$DIR1X/wait-$i.png" > /dev/null
97 fi
98
99 if [ "$DIR1_5X/wait-$i.png" -ot $RAWSVG ] ; then
100 inkscape -i wait-$i -d 144 -f $RAWSVG -e "$DIR1_5X/wait-$i.png" > /dev/null
101 fi
102
103 if [ "$DIR2X/wait-$i.png" -ot $RAWSVG ] ; then
104 inkscape -i wait-$i -d 192 -f $RAWSVG -e "$DIR2X/wait-$i.png" > /dev/null
105 fi
106 done
107
108 for i in 09 10 11 12 13 14 15 16
109 do
110 echo -ne "\033[0KGenerating animated cursor pixmaps... $i / 16 \\r"
111
112 if [ "$DIR1X/wait-$i.png" -ot $RAWSVG ] ; then
113 inkscape -i wait-$i -d 96 -f $RAWSVG -e "$DIR1X/wait-$i.png" > /dev/null
114 fi
115
116 if [ "$DIR1_5X/wait-$i.png" -ot $RAWSVG ] ; then
117 inkscape -i wait-$i -d 144 -f $RAWSVG -e "$DIR1_5X/wait-$i.png" > /dev/null
118 fi
119
120 if [ "$DIR2X/wait-$i.png" -ot $RAWSVG ] ; then
121 inkscape -i wait-$i -d 192 -f $RAWSVG -e "$DIR2X/wait-$i.png" > /dev/null
122
123 fi
124
125 done
126 echo -e "\033[0KGenerating animated cursor pixmaps... DONE"
127
128
129
130 echo -ne "Generating cursor theme...\\r"
131 for CUR in src/config/*.cursor; do
132 BASENAME=$CUR
133 BASENAME=${BASENAME##*/}
134 BASENAME=${BASENAME%.*}
135
136 ERR="$( xcursorgen -p build "$CUR" "$OUTPUT/cursors/$BASENAME" 2>&1 )"
137
138 if [[ "$?" -ne "0" ]]; then
139 echo "FAIL: $CUR $ERR"
140 fi
141 done
142 echo -e "Generating cursor theme... DONE"
143
144
145
146 echo -ne "Generating shortcuts...\\r"
147 while read ALIAS ; do
148 FROM=${ALIAS% *}
149 TO=${ALIAS#* }
150
151 if [ -e "$OUTPUT/cursors/$FROM" ] ; then
152 continue
153 fi
154
155 ln -s "$TO" "$OUTPUT/cursors/$FROM"
156 done < $ALIASES
157 echo -e "\033[0KGenerating shortcuts... DONE"
158
159
160
161 echo -ne "Copying Theme Index...\\r"
162 if ! [ -e "$OUTPUT/$INDEX" ] ; then
163 cp $INDEX "$OUTPUT/cursor.theme"
164 fi
165 echo -e "\033[0KCopying Theme Index... DONE"
166
167
168
169 echo "COMPLETE!"