summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLassulus <lassulus@googlemail.com>2012-12-10 01:12:54 +0100
committerLassulus <lassulus@googlemail.com>2012-12-10 01:12:54 +0100
commit88b6956f32ed74be82a401a7716398a622a9042f (patch)
tree6d1519155a36e04a32649a5a075fe8797a0a5486
parentc12143b68c9904a99e5e18f30db71fd4660733fd (diff)
more checks, fixed loop
-rwxr-xr-xretiolum/scripts/tinc_setup/new_install.sh23
1 files changed, 19 insertions, 4 deletions
diff --git a/retiolum/scripts/tinc_setup/new_install.sh b/retiolum/scripts/tinc_setup/new_install.sh
index bbf4475e..45316796 100755
--- a/retiolum/scripts/tinc_setup/new_install.sh
+++ b/retiolum/scripts/tinc_setup/new_install.sh
@@ -61,7 +61,7 @@ host2subnet()
result=$(($(($((1 << $1)) - 1)) << $((32 - $1))))
byte=""
- for ((i=0;i<3;i+=1)); do
+ for i in {0..2}; do
byte=.$(($result % 256))$byte
result=$(($result / 256))
done
@@ -151,11 +151,26 @@ if ! which awk&>/dev/null; then
exit 1
fi
-if ! which curl&>/dev/null; then
- echo "Please install curl"
+if ! which hostname&>/dev/null; then
+ echo "Please install hostname"
exit 1
fi
+if ! which openssl&>/dev/null; then
+ echo "Please install openssl"
+ exit 1
+fi
+
+if ! which curl&>/dev/null; then
+ if ! which wget&>/dev/null; then
+ echo "Please install curl or wget"
+ exit 1
+ else
+ LOADER='wget -O-'
+else
+ LOADER=curl
+fi
+
if ! $(/bin/ping -c 1 euer.krebsco.de -W 5 &>/dev/null) ;then
echo "Cant reach euer, check if your internet is working"
exit 1
@@ -232,7 +247,7 @@ fi
#get tinc-hostfiles
mkdir -p $TEMPDIR/hosts
-curl euer.krebsco.de/retiolum/hosts.tar.gz | tar zx -C $TEMPDIR/hosts/
+$LOADER euer.krebsco.de/retiolum/hosts.tar.gz | tar zx -C $TEMPDIR/hosts/
#check for free ip
#version 4