From 98a3f29407b102e8eecb1054d50fa7ec69c0dba4 Mon Sep 17 00:00:00 2001 From: hwdsl2 Date: Sat, 23 Sep 2017 14:19:30 -0500 Subject: [PATCH] Improve RPi fix - Minor improvement to Raspberry Pi fix --- vpnsetup.sh | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/vpnsetup.sh b/vpnsetup.sh index d4e5fcf..2d4b1f4 100755 --- a/vpnsetup.sh +++ b/vpnsetup.sh @@ -267,6 +267,12 @@ conn xauth-psk also=shared EOF +# Workaround for Raspbian 9 +if grep -qs 'Raspbian GNU/Linux 9' /etc/os-release; then + PRIVATE_IP=$(ip -4 route get 1 | awk '{print $NF;exit}') + check_ip "$PRIVATE_IP" && sed -i "s/left=%defaultroute/left=$PRIVATE_IP/" /etc/ipsec.conf +fi + # Specify IPsec PSK conf_bk "/etc/ipsec.secrets" cat > /etc/ipsec.secrets </dev/null service ipsec restart 2>/dev/null service xl2tpd restart 2>/dev/null -# Workaround for Raspbian 9 -if grep -qs raspbian /etc/os-release; then - if [ "$(sed 's/\..*//' /etc/debian_version)" = "9" ]; then - PRIVATE_IP=$(ip -4 route get 1 | awk '{print $NF;exit}') - check_ip "$PRIVATE_IP" && sed -i "s/left=%defaultroute/left=$PRIVATE_IP/" /etc/ipsec.conf - service ipsec restart - fi -fi - cat <