This repository has been archived by the owner on Feb 28, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
install.sh
executable file
·340 lines (289 loc) · 10.3 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
#!/bin/bash
# List of Supported Distros
os_array=('Fedora Linux' 'Manjaro Linux' 'Arch Linux' 'Ubuntu' 'Pop!_OS')
# If user == root, then stop the script
if [ $(whoami) == 'root' ]; then
echo "Please run as regular user!"
exit 1
fi
# Check the Name of a User
ORIGIN_USER=$(whoami)
# Ask for sudo password
echo "Asking for sudo password"
PASS=`zenity --password --title "Install Animated Wallpaper"`
# Checking if user has cancelled the password prompt
case $? in
0)
;;
1)
zenity --info --width=500\
--text="Unfortunately, it is not possible for me to work like this."
exit 0
;;
-1)
echo "Exiting"
exit 1
;;
esac
# Checking if provided password isn't empty
if [ -z "$PASS" ]; then
zenity --question --width=500\
--text="Provided empty sudo password. Continue?"
case $? in
0)
;;
1)
zenity --info --width 500\
--text="Unfortunately, it is not possible for me to work like this."
exit 0
;;
-1)
zenity --info --width 500\
--text="Oops. This should not have happened...."
exit 1
;;
esac
fi
# Checking if provided password is correct
echo "$PASS" | sudo -S -k -v
case $? in
0)
echo "Verified sudo privileges."
;;
1)
zenity --info --width 500\
--text="Cannot run with sufficient privileges."
exit 0
;;
-1)
zenity --info --width 500\
--text="Oops. This should not have happened...."
exit 1
;;
esac
# Detect OS
if [ -f /etc/os-release ]; then
# freedesktop.org and systemd
. /etc/os-release
OS=$NAME
elif type lsb_release >/dev/null 2>&1; then
OS=$(lsb_release -si)
elif [ -f /etc/lsb-release ]; then
. /etc/lsb-release
OS=$DISTRIB_ID
else
# Fall back to uname, e.g. "Linux <version>", also works for BSD, etc.
OS=$(uname -s)
VER=$(uname -r)
fi
# Check if OS is Supported in os_array
os_check="0"
for i in "${os_array[@]}"; do
if [ "$OS" == "$i" ]; then
os_check="1"
echo "$os_check"
fi
done
vDownloader=$(zenity --list --title "Animated Wallpaper Helper" --text "Which video downloader do you want to use?"\
--column "Selection" --column "Typ" --radiolist --column "Info"\
TRUE yt-dlp "A fork of youtube-dl with more features and better performance" \
FALSE youtube-dl "The Classic Downloader" \
--width=800 --height=350)
if [ "$os_check" == "0" ]; then
zenity --question \
--text="Your Linux system is not supported by the automatic script. The following is a list of supported distributions. If your distro is based on one, you can try to use the installer from it. \n\n Would you like to try?" \
--width=600\
-- height=100
case $? in
0)
;;
1)
echo "Aborted"
exit 0
;;
-1)
zenity --info --width 500\
--text="Oops. This should not have happened...."
exit 1
;;
esac
OS=$(zenity --list \
--title="Select the name of the background set" \
--column="choose:"\
--height=400\
"${os_array[@]}")
case $? in
0)
os_check="1"
;;
1)
echo "Aborted"
exit 0
;;
-1)
zenity --info --width 500\
--text="Oops. This should not have happened...."
exit 1
;;
esac
fi
# Install Dependencies
if [ "$os_check" == "1" ]; then
if [ "$OS" == "Fedora Linux" ]; then
# Fedora
zenity --question --width 500\
--text="Fedora Detected. It needs to intigrate the rpmfusion repository for ffmpeg. Do you agree with this?"
case $? in
0)
echo Installing Fedora Dependencies
echo Add rpmfusion repository for ffmpeg
echo "$PASS" | sudo -S dnf install -y https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
echo Installing dev tools and dependencies
echo "$PASS" | sudo -S dnf install -y cmake gcc-c++ vala pkgconfig gtk3-devel clutter-devel clutter-gtk-devel clutter-gst3-devel $vDownloader ffmpeg && STATUS="OK"
;;
1)
zenity --info --width 500\
--text="Unfortunately, it is not possible for me to work like this."
exit 0
;;
-1)
zenity --info --width 500\
--text="Oops. This should not have happened...."
exit 0
;;
esac
elif [[ "$OS" == "Manjaro Linux" ]]; then
# Manjaro
zenity --question --width 500\
--text="Manjaro Detected. Is this correct?"
case $? in
0)
echo Renewing Package Database
echo "$PASS" | sudo -S pacman -Sy
echo Installing Manjaro Dependencies
echo "$PASS" | sudo -S pacman -S base-devel ffmpeg $vDownloader cmake vala pkgconfig gtk3 clutter clutter-gtk clutter-gst gst-libav --noconfirm && STATUS="OK"
;;
1)
zenity --info --width 500\
--text="Unfortunately, it is not possible for me to work like this."
exit 0
;;
-1)
zenity --info --width 500\
--text="Oops. This should not have happened...."
exit 0
;;
esac
elif [[ "$OS" == "Arch Linux" ]]; then
# Arch
zenity --question --width 500\
--text="Arch Linux Detected. Is this correct?"
case $? in
0)
echo Renewing Package Database
echo "$PASS" | sudo -S pacman -Sy
echo Installing Arch Linux Dependencies
echo "$PASS" | sudo -S pacman -S git base-devel ffmpeg $vDownloader cmake vala pkgconfig gtk3 clutter clutter-gtk clutter-gst gst-libav --noconfirm && STATUS="OK"
;;
1)
zenity --info --width 500\
--text="Unfortunately, it is not possible for me to work like this."
exit 0
;;
-1)
zenity --info --width 500\
--text="Oops. This should not have happened..."
exit 0
;;
esac
elif [[ "$OS" == "Ubuntu" ]]; then
# Ubuntu
zenity --question --width 500\
--text="Ubuntu Detected. Is this correct?"
case $? in
0)
echo Renewing Package Database
echo "$PASS" | sudo -S apt-get update
echo Installing Ubuntu Dependencies
echo "$PASS" | sudo -S apt install git ffmpeg $vDownloader valac cmake pkg-config libgtk-3-dev libclutter-gtk-1.0-dev libclutter-gst-3.0-dev build-essential --yes && STATUS="OK"
;;
1)
zenity --info --width 500\
--text="Unfortunately, it is not possible for me to work like this."
exit 0
;;
-1)
zenity --info --width 500\
--text="Oops. This should not have happened..."
exit 0
;;
esac
elif [[ "$OS" == "Pop!_OS" ]]; then
# Ubuntu
zenity --question --width 500\
--text="Pop!_OS Detected. Is this correct?"
case $? in
0)
echo Renewing Package Database
echo "$PASS" | sudo -S apt-get update
echo Installing Pop!_OS Dependencies
echo "$PASS" | sudo -S apt install git ffmpeg $vDownloader valac cmake pkg-config libgtk-3-dev libclutter-gtk-1.0-dev libclutter-gst-3.0-dev build-essential --yes && STATUS="OK"
;;
1)
zenity --info --width 500\
--text="Unfortunately, it is not possible for me to work like this."
exit 0
;;
-1)
zenity --info --width 500\
--text="Oops. This should not have happened..."
exit 0
;;
esac
else
echo "This OS is not Supported!"
fi
fi
if [ "$STATUS" == "OK" ]; then
# Clone and Install animated-wallpaper
echo 'Cloning animated-wallpaper from github. (https://github.com/Ninlives/animated-wallpaper)'
git clone https://github.com/Ninlives/animated-wallpaper
cd animated-wallpaper
cmake . && make && echo "$PASS" | sudo -S make install
cd ..
rm -rf animated-wallpaper
# Install animated_wallpaper_helper
echo "$PASS" | sudo -S cp -r awp /usr/local/share/
echo "$PASS" | sudo -S cp awp.desktop /usr/share/applications/
echo "$PASS" | sudo -S chmod +x /usr/local/share/awp/awp.sh
echo "$PASS" | sudo -S chmod +x /usr/local/share/awp/awp-autostart.sh
# Create Cachedir
Cachedir="$HOME/.cache/Animated_Wallpapers"
mkdir -p "$Cachedir"
# Save Downloader
VDownloaderSave="$Cachedir/vdownloader.txt"
echo $vDownloader > $VDownloaderSave
echo "Animated Wallpapers was installed successfully."
zenity --question --width 500\
--text="Animated Wallpapers was installed successfully. Do you want to start the script now?"
case $? in
0)
echo Start Animated Wallpaper
sudo -u $ORIGIN_USER sh "/usr/local/share/awp/awp.sh" & exit 0
;;
1)
exit 0
echo Close
;;
-1)
zenity --info --width 500\
--text="Oops. This should not have happened...."
exit 0
;;
esac
else
echo "Sorry but the Installer does not work on your system!"
zenity --error \
--text="Sorry but the Installer does not work on your system!"
fi
fi