From 9ea2b50daeb024827f2f4edbfb02ce035efdd349 Mon Sep 17 00:00:00 2001 From: hwdsl2 Date: Mon, 2 Jan 2017 01:43:21 -0600 Subject: [PATCH] Improve OS detection - Check /etc/lsb-release if command "lsb_release" is missing --- extras/vpnupgrade.sh | 3 +++ vpnsetup.sh | 3 +++ 2 files changed, 6 insertions(+) diff --git a/extras/vpnupgrade.sh b/extras/vpnupgrade.sh index d73515b..38255a0 100644 --- a/extras/vpnupgrade.sh +++ b/extras/vpnupgrade.sh @@ -21,6 +21,9 @@ exiterr() { echo "Error: $1" >&2; exit 1; } exiterr2() { echo "Error: 'apt-get install' failed." >&2; exit 1; } os_type="$(lsb_release -si 2>/dev/null)" +if [ -z "$os_type" ] && [ -f "/etc/lsb-release" ]; then + os_type="$(. /etc/lsb-release && echo "$DISTRIB_ID")" +fi if [ "$os_type" != "Ubuntu" ] && [ "$os_type" != "Debian" ] && [ "$os_type" != "Raspbian" ]; then exiterr "This script only supports Ubuntu/Debian." fi diff --git a/vpnsetup.sh b/vpnsetup.sh index 0b702b9..2ea82f9 100755 --- a/vpnsetup.sh +++ b/vpnsetup.sh @@ -46,6 +46,9 @@ check_ip() { } os_type="$(lsb_release -si 2>/dev/null)" +if [ -z "$os_type" ] && [ -f "/etc/lsb-release" ]; then + os_type="$(. /etc/lsb-release && echo "$DISTRIB_ID")" +fi if [ "$os_type" != "Ubuntu" ] && [ "$os_type" != "Debian" ] && [ "$os_type" != "Raspbian" ]; then exiterr "This script only supports Ubuntu/Debian." fi