commit 14330433290d000b848119581107f534686bfc49
parent 9c905a91af8b4c7e058f063d4ef2254eeead49e1
Author: sin <sin@2f30.org>
Date:   Tue,  7 Aug 2018 13:56:15 +0100
2f30-vpn: Factor out common part
Diffstat:
1 file changed, 8 insertions(+), 14 deletions(-)
diff --git a/2f30-vpn b/2f30-vpn
@@ -31,23 +31,23 @@ read name
 echo -n "IP address (ask sin@2f30.org to get one): "
 read address
 
-if test $os = Linux; then
-command -v ip >/dev/null || {
-	echo ip is not installed 1>&2
-	exit 1
-}
-
 echo -n "Device (tun is the default): "
 read device
 
 if test -z $device; then
-	device="tun"
+	device="tun0"
 fi
 
+if test $os = Linux; then
+command -v ip >/dev/null || {
+	echo ip is not installed 1>&2
+	exit 1
+}
+
 cat > $basedir/tinc.conf << EOF
 Name = $name
 AddressFamily = ipv4
-Device = /dev/net/$device
+Interface = $device
 ConnectTo = hydra
 EOF
 
@@ -64,12 +64,6 @@ EOF
 chmod +x $basedir/tinc-down
 
 elif test $os = OpenBSD; then
-echo -n "Device (tun0 is the default): "
-read device
-if test -z $device; then
-	device="tun0"
-fi
-
 cat > $basedir/tinc.conf << EOF
 Name = $name
 AddressFamily = ipv4