summaryrefslogtreecommitdiffstats
path: root/retiolum/scripts/tinc_setup/new_install.sh
diff options
context:
space:
mode:
Diffstat (limited to 'retiolum/scripts/tinc_setup/new_install.sh')
-rwxr-xr-xretiolum/scripts/tinc_setup/new_install.sh9
1 files changed, 8 insertions, 1 deletions
diff --git a/retiolum/scripts/tinc_setup/new_install.sh b/retiolum/scripts/tinc_setup/new_install.sh
index 1d16cfb9..410dce62 100755
--- a/retiolum/scripts/tinc_setup/new_install.sh
+++ b/retiolum/scripts/tinc_setup/new_install.sh
@@ -12,7 +12,14 @@ SUBNET4=${SUBNET4:-10.243}
SUBNET6=${SUBNET6:-42}
TEMPDIR=${TEMPDIR:-auto}
TINCDIR=${TINCDIR:-auto}
-SYSHOSTN=${HOSTNAME:-$(hostname)}
+
+if type hostname >/dev/null ;then SYSHOSTN=${HOSTNAME:-$(hostname)}
+elif type uci >/dev/null ;then SYSHOSTN=$(uci get system.@system[0].hostname)
+elif [ -e /etc/hostname ] ;then SYSHOSTN=$(cat /etc/hostname)
+else SYSHOSTN="unknown"
+fi
+
+#overwrite `found` hostname
HOSTN=${HOSTN:-$SYSHOSTN}
NETNAME=${NETNAME:-retiolum}
MASK4=${MASK4:-16}