22
33# user permission check
44if [ ! $( id -u) = 0 ]; then
5- echo " Error: Tor2web install script must be runned by root"
6- exit 1
5+ echo " Error: Tor2web install script must be runned by root"
6+ exit 1
77fi
88
99LOGFILE=" ./install.log"
@@ -55,21 +55,21 @@ DO () {
5555 CMD=$3
5656 fi
5757 echo -n " Running: \" $CMD \" ... "
58- $CMD & > ${LOGFILE}
58+ eval $CMD & > ${LOGFILE}
5959 if [ " $? " -eq " $RET " ]; then
6060 echo " SUCCESS"
6161 else
6262 echo " FAIL"
6363 echo " COMBINED STDOUT/STDERR OUTPUT OF FAILED COMMAND:"
64- cat ${FILE }
64+ cat ${LOGFILE }
6565 exit 1
6666 fi
6767}
6868
6969# Preliminary Requirements Check
7070ERR=0
7171echo " Checking preliminary Tor2web requirements"
72- for REQ in apt-key apt-get
72+ for REQ in apt-key apt-get wget
7373do
7474 if which $REQ > /dev/null; then
7575 echo " + $REQ requirement meet"
@@ -92,20 +92,17 @@ DO "rm -f $TMPFILE"
9292
9393DO " apt-get update -y"
9494
95- # on Ubuntu python-pip requires universe repository
96- if [ $DISTRO == " Ubuntu" ]; then
97- if [ " $DISTRO_CODENAME " = " precise" ]; then
98- echo " Installing python-software-properties"
99- DO " apt-get install python-software-properties -y"
100- fi
101-
102- if [ " $DISTRO_CODENAME " = " trusty" ]; then
103- echo " Installing software-properties-common"
104- DO " apt-get install software-properties-common -y"
105- fi
95+ if echo " $DISTRO_CODENAME " | grep -qE " ^(wheezy)$" ; then
96+ echo " Installing python-software-properties"
97+ DO " apt-get install python-software-properties -y"
98+ else
99+ echo " Installing software-properties-common"
100+ DO " apt-get install software-properties-common -y"
101+ fi
106102
103+ if ! grep -q " ^deb .*universe" /etc/apt/sources.list /etc/apt/sources.list.d/* ; then
107104 echo " Adding Ubuntu Universe repository"
108- add-apt-repository " deb http://archive.ubuntu.com/ubuntu $( lsb_release -sc) universe"
105+ DO " add-apt-repository ' deb http://archive.ubuntu.com/ubuntu $( lsb_release -sc) universe' "
109106fi
110107
111108if [ ! -f /etc/apt/sources.list.d/globaleaks.list ]; then
@@ -114,5 +111,4 @@ if [ ! -f /etc/apt/sources.list.d/globaleaks.list ]; then
114111fi
115112
116113DO " apt-get update -y"
117-
118114DO " apt-get install tor2web -y"
0 commit comments