forked from yorickvanzweeden/Ubuntu-NordVPN-Indicator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·46 lines (37 loc) · 1.12 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
#!/bin/bash
install_indicator()
{
# Installing indicator in opt directory
echo "Installing Ubuntu NordVPN Indicator"
sudo mkdir -p /opt/ubuntu-nordvpn-indicator/
sudo cp code/* /opt/ubuntu-nordvpn-indicator/
# Installing autostart desktop file
echo "Making sure the indicator starts at boot using autostart"
mkdir -p $HOME/.config/autostart
cp ubuntu-nordvpn-indicator.desktop $HOME/.config/autostart/
}
install_deps()
{
# Install gir1.2-appindicator
echo "Installing AppIndicator and Python-GI"
sudo apt-get install -y gir1.2-appindicator python-gi
}
# Install indicator
install_indicator
# Install dependencies if not present
deps_available=$(dpkg -l | grep -E "gir1.2-appindicator-|python-gi" | wc --lines)
if [[ $deps_available -eq 2 ]]
then
echo "Dependencies have been installed"
else
install_deps
fi
# Starting script
if pgrep -f "nordvpn_indicator" > /dev/null
then
echo "Killing indicator"
kill $(pgrep -f "nordvpn_indicator")
fi
echo "Starting indicator"
nohup $(command -v python) /opt/ubuntu-nordvpn-indicator/nordvpn_indicator.py >/dev/null 2>&1 &
echo "Finished"