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