install.sh
Bourne-Again shell script, ASCII text executable
1
#!/bin/bash
2
set -ueo pipefail
3
#set -x
4
5
repodir=$(cd $(dirname $0) && pwd)
6
srcdir=${repodir}/src
7
8
9
if [[ $(which gnome-shell 2> /dev/null) ]] ; then
10
gnomever_major=$(gnome-shell --version | cut -d ' ' -f 3 | cut -d . -f 1)
11
gnomever_minor=$(gnome-shell --version | cut -d ' ' -f 3 | cut -d . -f 2)
12
13
if [ -e ${srcdir}/gnome-shell/$gnomever_major.$gnomever_minor ]; then
14
gnomever=$gnomever_major.$gnomever_minor
15
elif [ -e ${srcdir}/gnome-shell/$gnomever_major.$(($gnomever_minor + 1)) ]; then
16
gnomever=$gnomever_major.$(($gnomever_minor + 1))
17
elif [ -e ${srcdir}/gnome-shell/$gnomever_major.$(($gnomever_minor - 1)) ]; then
18
gnomever=$gnomever_major.$(($gnomever_minor - 1))
19
else
20
gnomever=3.18
21
fi
22
else
23
gnomever=3.18
24
fi
25
26
echo
27
28
themedir_base_fallback=${destdir:-}/usr/share/themes/Flat-Plat
29
themedir_base=${THEME_DIR_BASE:-$themedir_base_fallback}
30
31
_COLOR_VARIANTS=(
32
''
33
'-dark'
34
'-light'
35
)
36
if [ ! -z "${COLOR_VARIANTS:-}" ] ; then
37
IFS=', ' read -r -a _COLOR_VARIANTS <<< "${COLOR_VARIANTS:-}"
38
fi
39
_SIZE_VARIANTS=(
40
''
41
'-compact'
42
)
43
if [ ! -z "${SIZE_VARIANTS:-}" ] ; then
44
IFS=', ' read -r -a _SIZE_VARIANTS <<< "${SIZE_VARIANTS:-}"
45
fi
46
47
for color in "${_COLOR_VARIANTS[@]}" ; do
48
for size in "${_SIZE_VARIANTS[@]}" ; do
49
echo Installing Flat-Plat${color}${size} ...
50
51
themedir=${themedir_base}${color}${size}
52
if [[ -d ${themedir} ]] ; then
53
rm -r ${themedir}
54
fi
55
install -d ${themedir}
56
57
# Copy COPYING
58
cd ${repodir}
59
cp -ur \
60
COPYING \
61
${themedir}
62
63
# Install index.theme
64
cd ${srcdir}
65
cp -ur \
66
index${color}${size}.theme \
67
${themedir}/index.theme
68
69
# Install Chrome Theme/Extention
70
install -d ${themedir}/chrome
71
cd ${srcdir}/chrome
72
cp -ur \
73
"Flat-Plat${color} Theme.crx" \
74
${themedir}/chrome
75
if [ "$color" != '-dark' ] ; then
76
cp -ur \
77
"Flat-Plat Scrollbars.crx" \
78
${themedir}/chrome
79
else
80
cp -ur \
81
"Flat-Plat${color} Scrollbars.crx" \
82
${themedir}/chrome
83
fi
84
85
# Install GNOME Shell Theme
86
install -d ${themedir}/gnome-shell
87
cd ${srcdir}/gnome-shell/${gnomever}
88
cp -ur \
89
no-events.svg \
90
no-notifications.svg \
91
process-working.svg \
92
${themedir}/gnome-shell
93
cp -urL \
94
extensions \
95
pad-osd.css \
96
${themedir}/gnome-shell
97
if [ "$color" != '-dark' ] ; then
98
cp -urL \
99
assets \
100
${themedir}/gnome-shell
101
else
102
cp -urL \
103
assets${color} \
104
${themedir}/gnome-shell/assets
105
fi
106
cp -ur \
107
gnome-shell${color}${size}.css \
108
${themedir}/gnome-shell/gnome-shell.css
109
glib-compile-resources \
110
--sourcedir=${themedir}/gnome-shell \
111
--target=${themedir}/gnome-shell/gnome-shell-theme.gresource \
112
gnome-shell-theme.gresource.xml
113
114
# Install GTK+ 2 Theme
115
install -d ${themedir}/gtk-2.0
116
cd ${srcdir}/gtk-2.0
117
cp -ur \
118
apps.rc \
119
hacks.rc \
120
main.rc \
121
${themedir}/gtk-2.0
122
if [ "$color" != '-dark' ] ; then
123
cp -ur \
124
assets \
125
${themedir}/gtk-2.0
126
else
127
cp -ur \
128
assets${color} \
129
${themedir}/gtk-2.0/assets
130
fi
131
cp -ur \
132
gtkrc${color} \
133
${themedir}/gtk-2.0/gtkrc
134
135
# Install GTK+ 3 Theme
136
install -d ${themedir}/gtk-common
137
cd ${srcdir}/gtk-3.0/gtk-common
138
cp -ur \
139
assets \
140
${themedir}/gtk-common
141
142
for version in '3.18' '3.20' '3.22' ; do
143
if [ "$version" == '3.18' ] ; then
144
install -d ${themedir}/gtk-3.0
145
cd ${srcdir}/gtk-3.0/${version}
146
cp -ur \
147
assets \
148
${themedir}/gtk-3.0
149
cp -ur \
150
gtk${color}.css \
151
${themedir}/gtk-3.0/gtk.css
152
if [ "$color" != '-dark' ] && [ -f gtk-dark.css ]; then
153
cp -ur \
154
gtk-dark.css \
155
${themedir}/gtk-3.0
156
fi
157
else
158
install -d ${themedir}/gtk-${version}
159
cd ${srcdir}/gtk-3.0/${version}
160
cp -ur \
161
assets \
162
${themedir}/gtk-${version}
163
cp -ur \
164
gtk${color}${size}.css \
165
${themedir}/gtk-${version}/gtk.css
166
if [ "$color" != '-dark' ] && [ -f gtk-dark.css ]; then
167
cp -ur \
168
gtk-dark${size}.css \
169
${themedir}/gtk-${version}/gtk-dark.css
170
fi
171
fi
172
done
173
174
# Install Metacity Theme
175
install -d ${themedir}/metacity-1
176
cd ${srcdir}/metacity-1
177
cp -ur \
178
*.svg \
179
${themedir}/metacity-1
180
if [ "$color" != '-light' ] ; then
181
cp -ur \
182
metacity-theme-2.xml \
183
metacity-theme-3.xml \
184
${themedir}/metacity-1
185
else
186
cp -ur \
187
metacity-theme-2${color}.xml \
188
${themedir}/metacity-1/metacity-theme-2.xml
189
cp -ur \
190
metacity-theme-3${color}.xml \
191
${themedir}/metacity-1/metacity-theme-3.xml
192
fi
193
194
# Install Unity Theme
195
install -d ${themedir}/unity
196
cd ${srcdir}/unity
197
cp -ur \
198
*.svg \
199
*.png \
200
*.json \
201
${themedir}/unity
202
if [ "$color" != '-light' ] ; then
203
cp -ur \
204
buttons \
205
${themedir}/unity
206
else
207
cp -urT \
208
buttons${color} \
209
${themedir}/unity/buttons
210
fi
211
212
# Install Xfwm Theme
213
install -d ${themedir}/xfwm4
214
cd ${srcdir}/xfwm4
215
cp -ur \
216
*.svg \
217
themerc \
218
${themedir}/xfwm4
219
if [ "$color" != '-light' ] ; then
220
cp -ur \
221
assets \
222
${themedir}/xfwm4
223
else
224
cp -urT \
225
assets${color} \
226
${themedir}/xfwm4/assets
227
fi
228
done
229
done
230
231
echo
232
echo Done.
233
234
# vim: set tabstop=2 softtabstop=2 expandtab shiftwidth=2 smarttab:
235