1
0
mirror of synced 2024-11-22 04:56:03 +03:00

Improve OS detection

This commit is contained in:
hwdsl2 2020-01-13 00:07:39 -08:00
parent 4b28ce5de9
commit 4360737eaf
7 changed files with 19 additions and 11 deletions

View File

@ -2,7 +2,7 @@
#
# Script to add/update an VPN user for both IPsec/L2TP and Cisco IPsec
#
# Copyright (C) 2018-2019 Lin Song <linsongui@gmail.com>
# Copyright (C) 2018-2020 Lin Song <linsongui@gmail.com>
#
# This work is licensed under the Creative Commons Attribution-ShareAlike 3.0
# Unported License: http://creativecommons.org/licenses/by-sa/3.0/

View File

@ -2,7 +2,7 @@
#
# Script to delete an VPN user for both IPsec/L2TP and Cisco IPsec
#
# Copyright (C) 2018-2019 Lin Song <linsongui@gmail.com>
# Copyright (C) 2018-2020 Lin Song <linsongui@gmail.com>
#
# This work is licensed under the Creative Commons Attribution-ShareAlike 3.0
# Unported License: http://creativecommons.org/licenses/by-sa/3.0/

View File

@ -2,7 +2,7 @@
#
# Script to update VPN users for both IPsec/L2TP and Cisco IPsec
#
# Copyright (C) 2018-2019 Lin Song <linsongui@gmail.com>
# Copyright (C) 2018-2020 Lin Song <linsongui@gmail.com>
#
# This work is licensed under the Creative Commons Attribution-ShareAlike 3.0
# Unported License: http://creativecommons.org/licenses/by-sa/3.0/

View File

@ -2,7 +2,7 @@
#
# Script to upgrade Libreswan on Ubuntu and Debian
#
# Copyright (C) 2016-2019 Lin Song <linsongui@gmail.com>
# Copyright (C) 2016-2020 Lin Song <linsongui@gmail.com>
#
# This work is licensed under the Creative Commons Attribution-ShareAlike 3.0
# Unported License: http://creativecommons.org/licenses/by-sa/3.0/
@ -28,7 +28,9 @@ if [ -z "$os_type" ]; then
[ -f /etc/lsb-release ] && os_type=$(. /etc/lsb-release && printf '%s' "$DISTRIB_ID")
fi
if ! printf '%s' "$os_type" | head -n 1 | grep -qiF -e ubuntu -e debian -e raspbian; then
exiterr "This script only supports Ubuntu and Debian."
echo "Error: This script only supports Ubuntu and Debian." >&2
echo "For CentOS/RHEL, use https://git.io/vpnupgrade-centos" >&2
exit 1
fi
if [ "$(sed 's/\..*//' /etc/debian_version)" = "7" ]; then

View File

@ -2,7 +2,7 @@
#
# Script to upgrade Libreswan on CentOS and RHEL
#
# Copyright (C) 2016-2019 Lin Song <linsongui@gmail.com>
# Copyright (C) 2016-2020 Lin Song <linsongui@gmail.com>
#
# This work is licensed under the Creative Commons Attribution-ShareAlike 3.0
# Unported License: http://creativecommons.org/licenses/by-sa/3.0/
@ -23,7 +23,9 @@ exiterr2() { exiterr "'yum install' failed."; }
vpnupgrade() {
if ! grep -qs -e "release 6" -e "release 7" -e "release 8" /etc/redhat-release; then
exiterr "This script only supports CentOS/RHEL 6, 7 and 8."
echo "Error: This script only supports CentOS/RHEL 6, 7 and 8." >&2
echo "For Ubuntu/Debian, use https://git.io/vpnupgrade" >&2
exit 1
fi
if [ -f /proc/user_beancounters ]; then

View File

@ -8,7 +8,7 @@
# The latest version of this script is available at:
# https://github.com/hwdsl2/setup-ipsec-vpn
#
# Copyright (C) 2014-2019 Lin Song <linsongui@gmail.com>
# Copyright (C) 2014-2020 Lin Song <linsongui@gmail.com>
# Based on the work of Thomas Sarlandie (Copyright 2012)
#
# This work is licensed under the Creative Commons Attribution-ShareAlike 3.0
@ -54,7 +54,9 @@ if [ -z "$os_type" ]; then
[ -f /etc/lsb-release ] && os_type=$(. /etc/lsb-release && printf '%s' "$DISTRIB_ID")
fi
if ! printf '%s' "$os_type" | head -n 1 | grep -qiF -e ubuntu -e debian -e raspbian; then
exiterr "This script only supports Ubuntu and Debian."
echo "Error: This script only supports Ubuntu and Debian." >&2
echo "For CentOS/RHEL, use https://git.io/vpnsetup-centos" >&2
exit 1
fi
if [ "$(sed 's/\..*//' /etc/debian_version)" = "7" ]; then

View File

@ -8,7 +8,7 @@
# The latest version of this script is available at:
# https://github.com/hwdsl2/setup-ipsec-vpn
#
# Copyright (C) 2015-2019 Lin Song <linsongui@gmail.com>
# Copyright (C) 2015-2020 Lin Song <linsongui@gmail.com>
# Based on the work of Thomas Sarlandie (Copyright 2012)
#
# This work is licensed under the Creative Commons Attribution-ShareAlike 3.0
@ -49,7 +49,9 @@ check_ip() {
vpnsetup() {
if ! grep -qs -e "release 6" -e "release 7" -e "release 8" /etc/redhat-release; then
exiterr "This script only supports CentOS/RHEL 6, 7 and 8."
echo "Error: This script only supports CentOS/RHEL 6, 7 and 8." >&2
echo "For Ubuntu/Debian, use https://git.io/vpnsetup" >&2
exit 1
fi
if [ -f /proc/user_beancounters ]; then