Update OS check

- Add a check for Ubuntu 18.04 on architectures other than x86_64,
  which is not supported by the VPN scripts for Libreswan 4.9.
This commit is contained in:
hwdsl2 2022-10-24 18:50:51 -05:00
parent 19d4ea067f
commit 4f8a19d337
2 changed files with 18 additions and 2 deletions

View File

@ -41,6 +41,7 @@ check_vz() {
check_os() {
os_type=$(lsb_release -si 2>/dev/null)
os_arch=$(uname -m | tr -dc 'A-Za-z0-9_-')
[ -z "$os_type" ] && [ -f /etc/os-release ] && os_type=$(. /etc/os-release && printf '%s' "$ID")
case $os_type in
[Uu]buntu)
@ -60,6 +61,14 @@ check_os() {
if [ "$os_ver" = 8 ] || [ "$os_ver" = "jessiesid" ]; then
exiterr "Debian 8 or Ubuntu < 16.04 is not supported."
fi
if [ "$os_type" = "ubuntu" ] && [ "$os_ver" = "bustersid" ] \
&& [ "$os_arch" != "x86_64" ]; then
cat 1>&2 <<EOF
Error: For Ubuntu 18.04, this script supports only the x86_64 architecture.
This system runs on $os_arch and is unsupported.
EOF
exit 1
fi
}
check_libreswan() {
@ -172,7 +181,6 @@ install_pkgs() {
}
install_nss_pkgs() {
os_arch=$(uname -m | tr -dc 'A-Za-z0-9_-')
if [ "$os_type" = "ubuntu" ] && [ "$os_ver" = "bustersid" ] && [ "$os_arch" = "x86_64" ] \
&& ! dpkg -l libnss3-dev 2>/dev/null | grep -qF '3.49.1'; then
base_url="https://github.com/hwdsl2/vpn-extras/releases/download/v1.0.0"

View File

@ -74,6 +74,7 @@ EOF
check_os() {
os_type=$(lsb_release -si 2>/dev/null)
os_arch=$(uname -m | tr -dc 'A-Za-z0-9_-')
[ -z "$os_type" ] && [ -f /etc/os-release ] && os_type=$(. /etc/os-release && printf '%s' "$ID")
case $os_type in
[Uu]buntu)
@ -93,6 +94,14 @@ check_os() {
if [ "$os_ver" = 8 ] || [ "$os_ver" = "jessiesid" ]; then
exiterr "Debian 8 or Ubuntu < 16.04 is not supported."
fi
if [ "$os_type" = "ubuntu" ] && [ "$os_ver" = "bustersid" ] \
&& [ "$os_arch" != "x86_64" ]; then
cat 1>&2 <<EOF
Error: For Ubuntu 18.04, this script supports only the x86_64 architecture.
This system runs on $os_arch and is unsupported.
EOF
exit 1
fi
}
check_iface() {
@ -261,7 +270,6 @@ install_vpn_pkgs() {
}
install_nss_pkgs() {
os_arch=$(uname -m | tr -dc 'A-Za-z0-9_-')
if [ "$os_type" = "ubuntu" ] && [ "$os_ver" = "bustersid" ] && [ "$os_arch" = "x86_64" ] \
&& ! dpkg -l libnss3-dev 2>/dev/null | grep -qF '3.49.1'; then
base_url="https://github.com/hwdsl2/vpn-extras/releases/download/v1.0.0"