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