From 857c6b9bea3e427c553bce01405e0d8623522508 Mon Sep 17 00:00:00 2001 From: hwdsl2 Date: Tue, 10 May 2022 09:02:46 -0500 Subject: [PATCH] Add LXC check --- vpnsetup_centos.sh | 12 ++++++++++++ vpnsetup_ubuntu.sh | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/vpnsetup_centos.sh b/vpnsetup_centos.sh index 6684050..8fb2003 100755 --- a/vpnsetup_centos.sh +++ b/vpnsetup_centos.sh @@ -64,6 +64,17 @@ check_vz() { fi } +check_lxc() { + # shellcheck disable=SC2154 + if [ "$container" = "lxc" ] && [ ! -e /dev/ppp ]; then +cat 1>&2 <<'EOF' +Error: /dev/ppp is missing. LXC containers require configuration. + See: https://github.com/hwdsl2/setup-ipsec-vpn/issues/1014 +EOF + exit 1 + fi +} + check_os() { os_type=centos rh_file="/etc/redhat-release" @@ -705,6 +716,7 @@ EOF vpnsetup() { check_root check_vz + check_lxc check_os check_iface check_creds diff --git a/vpnsetup_ubuntu.sh b/vpnsetup_ubuntu.sh index e5d0768..65eb64c 100755 --- a/vpnsetup_ubuntu.sh +++ b/vpnsetup_ubuntu.sh @@ -63,6 +63,17 @@ check_vz() { fi } +check_lxc() { + # shellcheck disable=SC2154 + if [ "$container" = "lxc" ] && [ ! -e /dev/ppp ]; then +cat 1>&2 <<'EOF' +Error: /dev/ppp is missing. LXC containers require configuration. + See: https://github.com/hwdsl2/setup-ipsec-vpn/issues/1014 +EOF + exit 1 + fi +} + check_os() { os_type=$(lsb_release -si 2>/dev/null) [ -z "$os_type" ] && [ -f /etc/os-release ] && os_type=$(. /etc/os-release && printf '%s' "$ID") @@ -677,6 +688,7 @@ EOF vpnsetup() { check_root check_vz + check_lxc check_os check_iface check_creds