forked from dvilelaf/NordIndicator
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·110 lines (93 loc) · 3.45 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·110 lines (93 loc) · 3.45 KB
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
#!/bin/bash
#Install script for NordIndicator
#Check if not running as root
if [ "$EUID" -eq 0 ];then
echo "Please run this script as User and not Root"
exit
fi
install () {
#Setting dir
mkdir -p "$HOME""/.local/bin"
mkdir -p "$HOME""/.local/share/NordIndicator"
mkdir -p "$HOME""/.local/share/applications"
mkdir -p "$HOME""/.config/NordIndicator"
# Copying files
cp "./src/vpn_on.svg" "$HOME""/.local/share/NordIndicator/"
cp "./src/vpn_off.svg" "$HOME""/.local/share/NordIndicator/"
cp "./src/vpn_error.svg" "$HOME""/.local/share/NordIndicator/"
cp "./NordIndicator.py" "$HOME""/.local/share/NordIndicator/"
cp "./src/NordIndicator" "$HOME""/.local/bin/"
cp "./src/Uninstall.sh" "$HOME""/.local/share/NordIndicator/"
sed "s=vpn_on=$HOME/.local/share/NordIndicator/vpn_on.svg=" "src/NordIndicator.desktop" > "src/TEMPNordIndicator.desktop"
sed "s=NILocation=$HOME/.local/bin/NordIndicator=" "src/TEMPNordIndicator.desktop" > "$HOME/.local/share/applications/NordIndicator.desktop"
if [ -f "$HOME""/.config/NordIndicator/config.py" ]; then
if [ "$1" = "-q" ];then
echo "New config file saved as config.py.new"
cp "./src/config.py" "$HOME""/.config/NordIndicator/config.py.new"
else
while true; do
read -r -p "Would you like to override with the new config file ? [Y/n] " input
case $input in
[yY][eE][sS]|[yY])
echo "Copying new config file, old one will be saved as config.py.old"
mv "$HOME""/.config/NordIndicator/config.py" "$HOME""/.config/NordIndicator/config.py.old"
cp "./src/config.py" "$HOME""/.config/NordIndicator/"
break
;;
*)
echo "New config file saved as config.py.new"
cp "./src/config.py" "$HOME""/.config/NordIndicator/config.py.new"
break
;;
esac
done
fi
fi
# Setting permission
chmod +x "$HOME""/.local/bin/NordIndicator"
# Adding NordIndicator to .profile
if ! grep -q "NordIndicator" "$HOME""/.profile";then
echo 'export PATH=$PATH:'"$HOME/.local/bin/NordIndicator" >> "$HOME/.profile"
sleep 2s
source "$HOME/.profile"
fi
# Adding to autostart
cp "$HOME/.local/share/applications/NordIndicator.desktop" "$HOME/.config/autostart/"
if [ ! "$1" = "-q" ];then
# Verify update and start NordIndicator
NordIndicator -uq -r
fi
}
reinstall () {
echo "Uninstalling older version first"
chmod +x ./src/Uninstall.sh
./src/Uninstall.sh -q
echo "Older version uninstall complete"
echo "Starting fresh install of NordIndicator"
install "$@"
}
if [ "$1" = "-q" ];then
reinstall "$@"
exit
fi
#Using desktop file as it is on older version
if [ -f "$HOME/.local/share/applications/NordIndicator.desktop" ];then
echo "NordIndicator is already installed"
while true; do
read -r -p "Would you like to upgrade it ? [Y/n] " input
case $input in
[yY][eE][sS]|[yY])
echo "reinstalling NordIndicator"
reinstall
break
;;
*)
echo "Ok, exiting script"
break
;;
esac
done
else
echo "Installing NordIndicator"
install
fi