This repository has been archived by the owner on Nov 18, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathtraktor.sh
executable file
·121 lines (106 loc) · 3.96 KB
/
traktor.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
#!/bin/bash
# License : GPLv3+
#=========functions=========
function restart {
sudo systemctl restart tor.service
echo "Done."
exit 0
}
function proxyOff {
gsettings set org.gnome.system.proxy mode 'none'
echo "Done."
exit 0
}
function proxyOn {
gsettings set org.gnome.system.proxy mode 'manual'
echo "Done."
exit 0
}
function help { #need more commits
echo -e "OPTIONS \n\nuninstall Uninstalls the supported distro \nrestart Restarts the tor.service\nproxy-off Disables the system wide proxy\nproxy-on\
Enables the system wide proxy\n\n/~https://github.com/ubuntu-ir/traktor" | less
exit 0
exit 0
}
function uninstall {
if zypper search i+ &> /dev/null ; then
if [ ! -f ./uninstall_opensuse.sh ]; then
wget -O ./uninstall_opensuse.sh 'https://raw.githubusercontent.com/ubuntu-ir/traktor/master/uninstall_opensuse.sh' || curl -O https://raw.githubusercontent.com/ubuntu-ir/traktor/master/uninstall_opensuse.sh
fi
sudo chmod +x ./uninstall_opensuse.sh
./uninstall_opensuse.sh
#echo "opensuse"
elif apt list --installed &> /dev/null ;then
if [ ! -f ./uninstall_debian.sh ]; then
wget -O ./uninstall_debian.sh 'https://raw.githubusercontent.com/ubuntu-ir/traktor/master/uninstall_debian.sh' || curl -O https://raw.githubusercontent.com/ubuntu-ir/traktor/master/uninstall_debian.sh
fi
sudo chmod +x ./uninstall_debian.sh
./uninstall_debian.sh
# echo "debian"
else
echo "Your distro is neither debianbase nor susebase So, The script is not going to work in your distro."
fi
exit 0
}
function none {
echo -e 'Switch not defined .\nPlease read the help "./traktor.sh help"'
exit 1
}
#=======main=======
#searchs or args to call the right function
case "$1" in
"help") help ;;
"restart") restart ;;
"proxy-on") proxyOn ;;
"proxy-off") proxyOff ;;
"uninstall") uninstall ;;
"") ;;
*) none ;;
esac
#no args --> instaling tor
#Checking if the distro is debianbase / archbase / redhatbase/ susebase and running the correct script
if pacman -Q &> /dev/null ;then
if [ ! -f ./traktor_arch.sh ]; then
wget -O ./traktor_arch.sh 'https://raw.githubusercontent.com/ubuntu-ir/traktor/master/traktor_arch.sh' || curl -O https://raw.githubusercontent.com/ubuntu-ir/traktor/master/traktor_arch.sh
fi
sudo chmod +x ./traktor_arch.sh
./traktor_arch.sh
# echo "arch"
elif apt list --installed &> /dev/null ;then
if [ ! -f ./traktor_debian.sh ]; then
wget -O ./traktor_debian.sh 'https://raw.githubusercontent.com/ubuntu-ir/traktor/master/traktor_debian.sh' || curl -O https://raw.githubusercontent.com/ubuntu-ir/traktor/master/traktor_debian.sh
fi
sudo chmod +x ./traktor_debian.sh
./traktor_debian.sh
# echo "debian"
elif dnf list &> /dev/null ;then
if [ ! -f ./traktor_fedora.sh ]; then
wget -O ./traktor_fedora.sh 'https://raw.githubusercontent.com/ubuntu-ir/traktor/master/traktor_fedora.sh' || curl -O https://raw.githubusercontent.com/ubuntu-ir/traktor/master/traktor_fedora.sh
fi
sudo chmod +x ./traktor_fedora.sh
./traktor_fedora.sh
# echo "fedora"
elif zypper search i+ &> /dev/null ;then
if [ ! -f ./traktor_opensuse.sh ]; then
wget -O ./traktor_opensuse.sh 'https://raw.githubusercontent.com/ubuntu-ir/traktor/master/traktor_opensuse.sh' || curl -O https://raw.githubusercontent.com/ubuntu-ir/traktor/master/traktor_opensuse.sh
fi
sudo chmod +x ./traktor_opensuse.sh
./traktor_opensuse.sh
# echo "openSUSE"
else
echo "Your distro is neither archbase nor debianbase nor redhatbase nor susebase So, The script is not going to work in your distro."
fi
if [ ! -f ./traktor.sh ]; then # if then -> detect remote install
if [ -f ./traktor_arch.sh ]; then
rm ./traktor_arch.sh
fi
if [ -f ./traktor_debian.sh ]; then
rm ./traktor_debian.sh
fi
if [ -f ./traktor_fedora.sh ]; then
rm ./traktor_fedora.sh
fi
if [ -f ./traktor_opensuse.sh ]; then
rm ./traktor_opensuse.sh
fi
fi