Update OS support

- Add support for Debian 13
- Cleanup
This commit is contained in:
hwdsl2
2025-08-28 02:31:08 -05:00
parent 4612cce33b
commit 6c332e86db
5 changed files with 41 additions and 82 deletions

View File

@@ -55,12 +55,9 @@ check_os() {
[Uu]buntu)
os_type=ubuntu
;;
[Dd]ebian|[Kk]ali)
[Dd]ebian|[Kk]ali|[Rr]aspbian)
os_type=debian
;;
[Rr]aspbian)
os_type=raspbian
;;
[Aa]lpine)
os_type=alpine
;;
@@ -92,7 +89,7 @@ check_iface() {
def_state=$(cat "/sys/class/net/$def_iface/operstate" 2>/dev/null)
if [ -n "$def_state" ] && [ "$def_state" != "down" ]; then
check_wl=0
if [ "$os_type" = "ubuntu" ] || [ "$os_type" = "debian" ] || [ "$os_type" = "raspbian" ]; then
if [ "$os_type" = "ubuntu" ] || [ "$os_type" = "debian" ]; then
if ! uname -m | grep -qi -e '^arm' -e '^aarch64'; then
check_wl=1
fi
@@ -161,7 +158,7 @@ remove_ipsec() {
remove_xl2tpd() {
bigecho "Removing xl2tpd..."
if [ "$os_type" = "ubuntu" ] || [ "$os_type" = "debian" ] || [ "$os_type" = "raspbian" ]; then
if [ "$os_type" = "ubuntu" ] || [ "$os_type" = "debian" ]; then
export DEBIAN_FRONTEND=noninteractive
apt-get -yqq purge xl2tpd >/dev/null
elif [ "$os_type" = "alpine" ]; then
@@ -232,7 +229,7 @@ get_vpn_subnets() {
update_iptables_rules() {
use_nft=0
if [ "$os_type" = "ubuntu" ] || [ "$os_type" = "debian" ] || [ "$os_type" = "raspbian" ] \
if [ "$os_type" = "ubuntu" ] || [ "$os_type" = "debian" ] \
|| [ "$os_type" = "alpine" ]; then
IPT_FILE=/etc/iptables.rules
IPT_FILE2=/etc/iptables/rules.v4
@@ -273,7 +270,7 @@ update_iptables_rules() {
$ipp -s "$XAUTH_NET" -o "$NET_IFACE" -m policy --dir out --pol none -j MASQUERADE
$ipp -s "$L2TP_NET" -o "$NET_IFACE" -j MASQUERADE
iptables-save > "$IPT_FILE"
if [ "$os_type" = "ubuntu" ] || [ "$os_type" = "debian" ] || [ "$os_type" = "raspbian" ]; then
if [ "$os_type" = "ubuntu" ] || [ "$os_type" = "debian" ]; then
if [ -f "$IPT_FILE2" ]; then
conf_bk "$IPT_FILE2"
/bin/cp -f "$IPT_FILE" "$IPT_FILE2"

View File

@@ -74,12 +74,9 @@ check_os() {
[Uu]buntu)
os_type=ubuntu
;;
[Dd]ebian|[Kk]ali)
[Dd]ebian|[Kk]ali|[Rr]aspbian)
os_type=debian
;;
[Rr]aspbian)
os_type=raspbian
;;
[Aa]lpine)
os_type=alpine
;;
@@ -100,23 +97,13 @@ EOF
else
os_ver=$(sed 's/\..*//' /etc/debian_version | tr -dc 'A-Za-z0-9')
if [ "$os_ver" = 8 ] || [ "$os_ver" = 9 ] || [ "$os_ver" = "stretchsid" ] \
|| [ "$os_ver" = "bustersid" ]; then
|| [ "$os_ver" = "bustersid" ] || [ -z "$os_ver" ]; then
cat 1>&2 <<EOF
Error: This script requires Debian >= 10 or Ubuntu >= 20.04.
This version of Ubuntu/Debian is too old and not supported.
EOF
exit 1
fi
if [ "$os_ver" = "trixiesid" ] && [ -f /etc/os-release ]; then
ubuntu_ver=$(. /etc/os-release && printf '%s' "$VERSION_ID")
if [ "$ubuntu_ver" = "24.10" ] || [ "$ubuntu_ver" = "25.04" ]; then
cat 1>&2 <<EOF
Error: This script does not support Ubuntu 24.10 or 25.04.
You may use e.g. Ubuntu 24.04 LTS instead.
EOF
exit 1
fi
fi
fi
fi
}
@@ -134,7 +121,7 @@ EOF
install_pkgs() {
if ! command -v wget >/dev/null 2>&1; then
if [ "$os_type" = "ubuntu" ] || [ "$os_type" = "debian" ] || [ "$os_type" = "raspbian" ]; then
if [ "$os_type" = "ubuntu" ] || [ "$os_type" = "debian" ]; then
export DEBIAN_FRONTEND=noninteractive
(
set -x

View File

@@ -57,31 +57,15 @@ check_os() {
;;
esac
os_ver=$(sed 's/\..*//' /etc/debian_version | tr -dc 'A-Za-z0-9')
if [ "$os_ver" = 13 ]; then
cat 1>&2 <<EOF
Error: This script does not currently support Debian 13.
You may use e.g. Debian 12 instead.
EOF
exit 1
fi
if [ "$os_ver" = 8 ] || [ "$os_ver" = 9 ] || [ "$os_ver" = "stretchsid" ] \
|| [ "$os_ver" = "bustersid" ]; then
|| [ "$os_ver" = "bustersid" ] || [ -z "$os_ver" ]; then
cat 1>&2 <<EOF
Error: This script requires Debian >= 10 or Ubuntu >= 20.04.
This version of Ubuntu/Debian is too old and not supported.
EOF
exit 1
fi
if [ "$os_ver" = "trixiesid" ] && [ -f /etc/os-release ]; then
ubuntu_ver=$(. /etc/os-release && printf '%s' "$VERSION_ID")
if [ "$ubuntu_ver" = "24.10" ] || [ "$ubuntu_ver" = "25.04" ]; then
cat 1>&2 <<EOF
Error: This script does not support Ubuntu 24.10 or 25.04.
You may use e.g. Ubuntu 24.04 LTS instead.
EOF
exit 1
fi
fi
[ -f /etc/os-release ] && ubuntu_ver=$(. /etc/os-release && printf '%s' "$VERSION_ID")
}
check_libreswan() {
@@ -185,7 +169,9 @@ update_apt_cache() {
install_pkgs() {
p1=libcurl4-nss-dev
[ "$os_ver" = "trixiesid" ] && p1=libcurl4-gnutls-dev
if [ "$os_ver" = "trixiesid" ] || [ "$os_ver" = 13 ]; then
p1=libcurl4-gnutls-dev
fi
(
set -x
apt-get -yqq install libnss3-dev libnspr4-dev pkg-config \
@@ -193,6 +179,14 @@ install_pkgs() {
$p1 libnss3-tools libevent-dev libsystemd-dev \
flex bison gcc make wget sed >/dev/null
) || exiterr2
if { [ "$os_type" = "ubuntu" ] && [ -n "$ubuntu_ver" ] \
&& printf '%s\n%s' "24.10" "$ubuntu_ver" | sort -C -V; } \
|| [ "$os_ver" = 13 ]; then
(
set -x
apt-get -yqq install systemd-dev >/dev/null
) || exiterr2
fi
}
get_libreswan() {

View File

@@ -106,12 +106,9 @@ check_os() {
[Uu]buntu)
os_type=ubuntu
;;
[Dd]ebian|[Kk]ali)
[Dd]ebian|[Kk]ali|[Rr]aspbian)
os_type=debian
;;
[Rr]aspbian)
os_type=raspbian
;;
[Aa]lpine)
os_type=alpine
;;
@@ -132,23 +129,13 @@ EOF
else
os_ver=$(sed 's/\..*//' /etc/debian_version | tr -dc 'A-Za-z0-9')
if [ "$os_ver" = 8 ] || [ "$os_ver" = 9 ] || [ "$os_ver" = "stretchsid" ] \
|| [ "$os_ver" = "bustersid" ]; then
|| [ "$os_ver" = "bustersid" ] || [ -z "$os_ver" ]; then
cat 1>&2 <<EOF
Error: This script requires Debian >= 10 or Ubuntu >= 20.04.
This version of Ubuntu/Debian is too old and not supported.
EOF
exit 1
fi
if [ "$os_ver" = "trixiesid" ] && [ -f /etc/os-release ]; then
ubuntu_ver=$(. /etc/os-release && printf '%s' "$VERSION_ID")
if [ "$ubuntu_ver" = "24.10" ] || [ "$ubuntu_ver" = "25.04" ]; then
cat 1>&2 <<EOF
Error: This script does not support Ubuntu 24.10 or 25.04.
You may use e.g. Ubuntu 24.04 LTS instead.
EOF
exit 1
fi
fi
fi
fi
}
@@ -161,7 +148,7 @@ check_iface() {
def_state=$(cat "/sys/class/net/$def_iface/operstate" 2>/dev/null)
check_wl=0
if [ -n "$def_state" ] && [ "$def_state" != "down" ]; then
if [ "$os_type" = "ubuntu" ] || [ "$os_type" = "debian" ] || [ "$os_type" = "raspbian" ]; then
if [ "$os_type" = "ubuntu" ] || [ "$os_type" = "debian" ]; then
if ! uname -m | grep -qi -e '^arm' -e '^aarch64'; then
check_wl=1
fi
@@ -228,7 +215,7 @@ wait_for_apt() {
while fuser "$apt_lk" "$pkg_lk" >/dev/null 2>&1 \
|| lsof "$apt_lk" >/dev/null 2>&1 || lsof "$pkg_lk" >/dev/null 2>&1; do
[ "$count" = 0 ] && echo "## Waiting for apt to be available..."
[ "$count" -ge 100 ] && exiterr "Could not get apt/dpkg lock."
[ "$count" -ge 200 ] && exiterr "Could not get apt/dpkg lock."
count=$((count+1))
printf '%s' '.'
sleep 3
@@ -237,7 +224,7 @@ wait_for_apt() {
install_pkgs() {
if ! command -v wget >/dev/null 2>&1; then
if [ "$os_type" = "ubuntu" ] || [ "$os_type" = "debian" ] || [ "$os_type" = "raspbian" ]; then
if [ "$os_type" = "ubuntu" ] || [ "$os_type" = "debian" ]; then
wait_for_apt
export DEBIAN_FRONTEND=noninteractive
(

View File

@@ -88,31 +88,15 @@ check_os() {
;;
esac
os_ver=$(sed 's/\..*//' /etc/debian_version | tr -dc 'A-Za-z0-9')
if [ "$os_ver" = 13 ]; then
cat 1>&2 <<EOF
Error: This script does not currently support Debian 13.
You may use e.g. Debian 12 instead.
EOF
exit 1
fi
if [ "$os_ver" = 8 ] || [ "$os_ver" = 9 ] || [ "$os_ver" = "stretchsid" ] \
|| [ "$os_ver" = "bustersid" ]; then
|| [ "$os_ver" = "bustersid" ] || [ -z "$os_ver" ]; then
cat 1>&2 <<EOF
Error: This script requires Debian >= 10 or Ubuntu >= 20.04.
This version of Ubuntu/Debian is too old and not supported.
EOF
exit 1
fi
if [ "$os_ver" = "trixiesid" ] && [ -f /etc/os-release ]; then
ubuntu_ver=$(. /etc/os-release && printf '%s' "$VERSION_ID")
if [ "$ubuntu_ver" = "24.10" ] || [ "$ubuntu_ver" = "25.04" ]; then
cat 1>&2 <<EOF
Error: This script does not support Ubuntu 24.10 or 25.04.
You may use e.g. Ubuntu 24.04 LTS instead.
EOF
exit 1
fi
fi
[ -f /etc/os-release ] && ubuntu_ver=$(. /etc/os-release && printf '%s' "$VERSION_ID")
}
check_iface() {
@@ -224,7 +208,7 @@ wait_for_apt() {
while fuser "$apt_lk" "$pkg_lk" >/dev/null 2>&1 \
|| lsof "$apt_lk" >/dev/null 2>&1 || lsof "$pkg_lk" >/dev/null 2>&1; do
[ "$count" = 0 ] && echo "## Waiting for apt to be available..."
[ "$count" -ge 100 ] && exiterr "Could not get apt/dpkg lock."
[ "$count" -ge 200 ] && exiterr "Could not get apt/dpkg lock."
count=$((count+1))
printf '%s' '.'
sleep 3
@@ -272,7 +256,9 @@ detect_ip() {
install_vpn_pkgs() {
bigecho "Installing packages required for the VPN..."
p1=libcurl4-nss-dev
[ "$os_ver" = "trixiesid" ] && p1=libcurl4-gnutls-dev
if [ "$os_ver" = "trixiesid" ] || [ "$os_ver" = 13 ]; then
p1=libcurl4-gnutls-dev
fi
(
set -x
apt-get -yqq install libnss3-dev libnspr4-dev pkg-config \
@@ -280,7 +266,15 @@ install_vpn_pkgs() {
$p1 flex bison gcc make libnss3-tools \
libevent-dev libsystemd-dev uuid-runtime ppp xl2tpd >/dev/null
) || exiterr2
if [ "$os_type" = "debian" ] && [ "$os_ver" = 12 ]; then
if { [ "$os_type" = "ubuntu" ] && [ -n "$ubuntu_ver" ] \
&& printf '%s\n%s' "24.10" "$ubuntu_ver" | sort -C -V; } \
|| [ "$os_ver" = 13 ]; then
(
set -x
apt-get -yqq install systemd-dev >/dev/null
) || exiterr2
fi
if [ "$os_type" = "debian" ] && printf '%s\n%s' "12" "$os_ver" | sort -C -V; then
(
set -x
apt-get -yqq install rsyslog >/dev/null