@@ -7,9 +7,6 @@ if [ ! $(id -u) = 0 ]; then
7
7
fi
8
8
9
9
INSTALL_LOG=" ./install.log"
10
- DISTRO=' unknown'
11
- DISTRO_VERSION=' unknown'
12
- SUPPORTED_PLATFORM=0
13
10
14
11
PGP_KEY="
15
12
-----BEGIN PGP PUBLIC KEY BLOCK-----
@@ -77,43 +74,48 @@ EYnJ858kK0cjt3aj11AcJnq81u//+5jl4FJOy/3lZ+VB
77
74
=J7+v
78
75
-----END PGP PUBLIC KEY BLOCK-----"
79
76
80
-
81
- if [ -r /lib/lsb/init-functions ]; then
82
- if [ " $( lsb_release -is ) " = " Debian" ]; then
83
- DISTRO=" debian"
84
- DISTRO_VERSION=" $( lsb_release -cs ) "
85
- else
86
- DISTRO=" ubuntu"
87
- DISTRO_VERSION=" $( lsb_release -cs ) "
88
- fi
77
+ DISTRO=" unknown"
78
+ DISTRO_CODENAME=" unknown"
79
+ if which lsb_release > /dev/null; then
80
+ DISTRO=" $( lsb_release -is ) "
81
+ DISTRO_CODENAME=" $( lsb_release -cs ) "
89
82
fi
90
83
91
- if [ " $DISTRO " = " debian" ]; then
92
- if [ " $DISTRO_VERSION " = " wheezy" ] || [ " $DISTRO_VERSION " = " jessie" ]; then
93
- SUPPORTED_PLATFORM=1
94
- fi
95
- elif [ " $DISTRO " = " ubuntu" ]; then
96
- if [ " $DISTRO_VERSION " = " precise" ] || [ " $DISTRO_VERSION " = " trusty" ]; then
97
- SUPPORTED_PLATFORM=1
98
- fi
84
+ SUPPORTED_PLATFORM=0
85
+ if [ " $DISTRO_CODENAME " = " precise" ] ||
86
+ [ " $DISTRO_CODENAME " = " trusty" ] ||
87
+ [ " $DISTRO_CODENAME " = " wheezy" ] ||
88
+ [ " $DISTRO_CODENAME " = " jessie" ]; then
89
+ SUPPORTED_PLATFORM=1
99
90
fi
100
91
101
92
if [ $SUPPORTED_PLATFORM -eq 0 ]; then
102
93
echo " !!!!!!!!!!!! WARNING !!!!!!!!!!!!"
103
- echo " You are attempting to install Tor2web on an unsupported platform."
104
- echo " Supported platform are Debian (wheezy, jessie ) and Ubuntu (precise, trusty)\n "
105
- echo " Do you wish to continue at your own risk [Y|N]? "
106
- read ans
107
- if [ $ans = y -o $ans = Y -o $ans = yes -o $ans = Yes -o $ans = YES ]
108
- then
109
- echo " Ok, you wanted it!\n "
110
- else
111
- echo " Installation aborted. Still friends, right? "
112
- exit
113
- fi
94
+ echo " You are attempting to install GlobaLeaks on an unsupported platform."
95
+ echo " Supported platform are Ubuntu (precise, trusty ) and Debian (wheezy, jessie) "
96
+
97
+ while true ; do
98
+ read -p " Do you wish to continue anyhow? [y|n]? " yn
99
+ case $yn in
100
+ [Yy] * ) break ;;
101
+ [Nn] * ) echo " Installation aborted. " ; exit ;;
102
+ * ) echo $yn ; echo " Please answer y/n. " ; continue ;;
103
+ esac
104
+ done
114
105
fi
115
106
116
- echo " Performing Tor2web installation on $DISTRO - $DISTRO_VERSION "
107
+ echo " Performing Tor2web installation on $DISTRO - $DISTRO_CODENAME "
108
+
109
+ if [ $SUPPORTED_PLATFORM -eq 0 ]; then
110
+ # In case of unsupported platforms we fallback on trusty
111
+ echo " Given that the platform is not supported the install script will use trusty repository."
112
+ echo " In case of failure refer to the wiki for manual setup possibilities."
113
+ echo " Tor2web Wiki Address: https://github.com/globaleaks/Tor2web/wiki"
114
+
115
+ # Given the fact that the platform is not supported be try as it is an Ubuntu 14.04
116
+ DISTRO=" Ubuntu"
117
+ DISTRO_CODENAME=" trusty"
118
+ fi
117
119
118
120
DO () {
119
121
if [ -z " $2 " ]; then
@@ -162,9 +164,29 @@ echo "$PGP_KEY" > $TMPFILE
162
164
DO " apt-key add $TMPFILE " " 0"
163
165
DO " rm -f $TMPFILE " " 0"
164
166
165
- if [ ! -f /etc/apt/sources.list.d/globaleaks ]; then
166
- echo " deb http://deb.globaleaks.org $DISTRO_VERSION /" > /etc/apt/sources.list.d/globaleaks.list
167
+ DO " apt-get update -y" " 0"
168
+
169
+ # on Ubuntu python-pip requires universe repository
170
+ if [ $DISTRO == ' Ubuntu' ]; then
171
+ if [ " $DISTRO_CODENAME " = " precise" ]; then
172
+ echo " Installing python-software-properties"
173
+ DO " apt-get install python-software-properties -y" " 0"
174
+ fi
175
+
176
+ if [ " $DISTRO_CODENAME " = " trusty" ]; then
177
+ echo " Installing software-properties-common"
178
+ DO " apt-get install software-properties-common -y" " 0"
179
+ fi
180
+
181
+ echo " Adding Ubuntu Universe repository"
182
+ DO " apt-add-repository universe" " 0"
183
+ fi
184
+
185
+ if [ ! -f /etc/apt/sources.list.d/globaleaks.list ]; then
186
+ # we avoid using apt-add-repository as we prefer using /etc/apt/sources.list.d/globaleaks.list
187
+ echo " deb http://deb.globaleaks.org $DISTRO_CODENAME /" > /etc/apt/sources.list.d/globaleaks.list
167
188
fi
168
189
169
190
DO " apt-get update -y" " 0"
191
+
170
192
DO " apt-get install tor2web -y" " 0"
0 commit comments