summaryrefslogtreecommitdiffstats
path: root/retiolum
diff options
context:
space:
mode:
Diffstat (limited to 'retiolum')
-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