-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.sh
executable file
·89 lines (72 loc) · 2.08 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
#!/bin/bash
_c_magneta="\e[95m"
_c_green="\e[32m"
_c_red="\e[31m"
_c_blue="\e[34m"
RST="\e[0m"
die() { echo -e "${_c_red}[E] ${*}${RST}";exit 1;:;}
warn() { echo -e "${_c_red}[W] ${*}${RST}";:;}
shout() { echo -e "${_c_blue}[-] ${*}${RST}";:;}
lshout() { echo -e "${_c_blue}-> ${*}${RST}";:;}
imsg() { if [ -n "$UDROID_VERBOSE" ]; then echo -e ": ${*} \e[0m" >&2;fi;:;}
msg() { echo -e "${*} \e[0m" >&2;:;}
if ! command -v python3 >/dev/null 2>&1; then
die "Python3 is not installed"
fi
if (( UID != 0 )); then
die "You need to be root to run this script"
fi
shout "Installing udroidmgr"
mkdir -pv /usr/share/udroid || {
die "Failed to create /usr/share/udroid"
}
if [ -d utils ]; then
cp -rv utils bash /usr/share/udroid/ || {
die "Failed to copy utils"
}
fi
if [ -f main.py ]; then
cp -v main.py /usr/share/udroid/ || {
die "Failed to copy main.py"
}
fi
# Clipboard watcher service
cp utils/clipboard_watcher.service /lib/systemd/system/clipboard_watcher.service || {
die "Failed to install clipboard_watcher.service"
}
if [ -f main.sh ]; then
cp -v main.sh /usr/share/udroid/ || {
die "Failed to copy main.sh"
}
fi
if [[ -f /usr/bin/startvnc ]]; then
rm -rvf /usr/bin/startvnc
fi
if [[ -f /usr/bin/stopvnc ]]; then
rm -rvf /usr/bin/stopvnc
fi
if [[ -f /usr/bin/udroid-upgrade-check ]]; then
rm -rvf /usr/bin/udroid-upgrade-check
fi
if [[ -f /usr/bin/udroid-upgrade ]]; then
rm -rvf /usr/bin/udroid-upgrade
fi
if [[ -f /usr/bin/udroid-adduser ]]; then
rm -rvf /usr/bin/udroid-adduser
fi
ln -sv /usr/share/udroid/main.sh /usr/bin/startvnc || {
die "Failed to create symlink"
}
ln -sv /usr/share/udroid/main.sh /usr/bin/stopvnc || {
die "Failed to create symlink"
}
ln -sv /usr/share/udroid/main.sh /usr/bin/udroid-upgrade-check || {
die "Failed to create symlink"
}
ln -sv /usr/share/udroid/main.sh /usr/bin/udroid-upgrade || {
die "Failed to create symlink"
}
ln -sv /usr/share/udroid/bash/adduser.sh /usr/bin/udroid-adduser || {
die "Failed to create symlink"
}
shout "Installation Complete."