Debian Codegraph @

cursors-src/bloom/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 180 -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 180 -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 180 -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 180 -f $RAWSVG -e "$DIR2X/wait-$i.png" > /dev/null
122 fi
123 done
124 echo -e "\033[0KGenerating animated cursor pixmaps... DONE"
125
126
127
128 echo -ne "Generating cursor theme...\\r"
129 for CUR in src/config/*.cursor; do
130 BASENAME=$CUR
131 BASENAME=${BASENAME##*/}
132 BASENAME=${BASENAME%.*}
133
134 ERR="$( xcursorgen -p build "$CUR" "$OUTPUT/cursors/$BASENAME" 2>&1 )"
135
136 if [[ "$?" -ne "0" ]]; then
137 echo "FAIL: $CUR $ERR"
138 fi
139 done
140 echo -e "Generating cursor theme... DONE"
141
142
143
144 echo -ne "Generating shortcuts...\\r"
145 while read ALIAS ; do
146 FROM=${ALIAS% *}
147 TO=${ALIAS#* }
148
149 if [ -e "$OUTPUT/cursors/$FROM" ] ; then
150 continue
151 fi
152
153 ln -s "$TO" "$OUTPUT/cursors/$FROM"
154 done < $ALIASES
155 echo -e "\033[0KGenerating shortcuts... DONE"
156
157
158
159 echo -ne "Copying Theme Index...\\r"
160 if ! [ -e "$OUTPUT/$INDEX" ] ; then
161 cp $INDEX "$OUTPUT/cursor.theme"
162 fi
163 echo -e "\033[0KCopying Theme Index... DONE"
164
165
166
167 echo "COMPLETE!"