summaryrefslogtreecommitdiffstats
path: root/retiolum/scripts/tinc_setup/new_install.sh
diff options
context:
space:
mode:
authorLassulus <lassulus@googlemail.com>2012-12-09 19:13:59 +0100
committerLassulus <lassulus@googlemail.com>2012-12-09 19:13:59 +0100
commit1fbaa63834a649cf9c96aac9dca1bc566196d64b (patch)
tree2da9fcbb681c3e8af0457c76b9c1628015e2e835 /retiolum/scripts/tinc_setup/new_install.sh
parent8e36e9942498b821ed3825d5f3b631e27aa4d265 (diff)
added variable stuff
Diffstat (limited to 'retiolum/scripts/tinc_setup/new_install.sh')
-rwxr-xr-xretiolum/scripts/tinc_setup/new_install.sh49
1 files changed, 34 insertions, 15 deletions
diff --git a/retiolum/scripts/tinc_setup/new_install.sh b/retiolum/scripts/tinc_setup/new_install.sh
index dcbb2670..3afae31a 100755
--- a/retiolum/scripts/tinc_setup/new_install.sh
+++ b/retiolum/scripts/tinc_setup/new_install.sh
@@ -104,21 +104,40 @@ find_os()
fi
}
-SUBNET4=10.243
-SUBNET6=42
-TEMPDIR=/tmp/tinc-install-fu
-HOSTN=$(hostname)
-NETNAME=retiolum
-MASK4=16
-MASK6=16
-RAND4=1
-RAND6=1
-URL=euer.krebsco.de/retiolum/hosts.tar.gz
-OS=0
-
-IRCCHANNEL="#krebsco"
-IRCSERVER="irc.freenode.net"
-IRCPORT=6667
+SUBNET4=${SUBNET4:-10.243}
+SUBNET6=${SUBNET6:-42}
+TEMPDIR=${TEMPDIR:-/tmp/tinc-install-fu}
+HOSTN=${HOSTN:-$(hostname)}
+NETNAME=${NETNAME:-retiolum}
+MASK4=${MASK4:-16}
+MASK6=${MASK6:-16}
+URL=${URL:-euer.krebsco.de/retiolum/hosts.tar.gz}
+
+IRCCHANNEL=${IRCCHANNEL:-"#krebsco"}
+IRCSERVER=${IRCSERVER:-"irc.freenode.net"}
+IRCPORT=${IRCPORT:-6667}
+
+OS=${OS:-0}
+
+IP4=${IP4:-0}
+IP6=${IP6:-0}
+
+RAND4=0
+RAND6=0
+
+if [ $IP4 -eq 0 ]; then
+ RAND4=1
+elif ! check_ip_valid4 $IP4; then
+ echo 'ip4 is invalid'
+ exit 1
+fi
+if [ $IP6 -eq 0 ]; then
+ RAND6=1
+elif ! check_ip_valid6 $IP6; then
+ echo 'ip6 is invalid'
+ exit 1
+fi
+
#check if everything is installed
if ! which tincd&>/dev/null; then