Skip to content

Commit

Permalink
M #-: Don't use interfaces netcfg on debian12
Browse files Browse the repository at this point in the history
  • Loading branch information
xorel committed Nov 27, 2023
1 parent 26b1ba7 commit f1bdbb6
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
20 changes: 12 additions & 8 deletions context-linux/src/etc/one-context.d/loc-10-network
Original file line number Diff line number Diff line change
Expand Up @@ -23,33 +23,37 @@
context_type="$1"
action="$2"
os_id=$(detect_os)
os_ver=$(detect_os_version)

if [ -z "${action}" ] ; then
action="configure"
fi

# update detect_os function if new distro is added
if [ -z "${NETCFG_TYPE}" ] ; then
case "${os_id}" in
alpine)
case "${os_id}${os_ver}" in
alpine*)
NETCFG_TYPE='interfaces'
;;
altlinux)
altlinux*)
NETCFG_TYPE='networkd nm'
;;
debian|devuan)
debian12)
NETCFG_TYPE='netplan networkd interfaces nm'
;;
devuan*|debian*)
NETCFG_TYPE='interfaces netplan nm networkd'
;;
ubuntu)
ubuntu*)
NETCFG_TYPE='netplan networkd interfaces nm'
;;
fedora|centos|rhel|almalinux|ol|rocky)
fedora*|centos*|rhel*|almalinux*|ol*|rocky*)
NETCFG_TYPE='nm networkd scripts'
;;
opensuse*|sles|sled)
opensuse*|sles*|sled*)
NETCFG_TYPE='scripts'
;;
amzn)
amzn*)
NETCFG_TYPE='scripts'
;;
freebsd)
Expand Down
14 changes: 13 additions & 1 deletion context-linux/src/etc/one-context.d/loc-10-network.d/functions
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,18 @@ detect_os()
fi
)

# return OS VERSION
detect_os_version()
(
if [ -f /etc/os-release ] ; then
VERSION_ID=
# shellcheck disable=SC1091
. /etc/os-release

echo "$VERSION_ID"
fi
)

# arg: <iface>
disable_ipv6()
(
Expand Down Expand Up @@ -606,4 +618,4 @@ get_onegate_ip() {

missing_onegate_proxy_route() {
is_link_local "$onegate_host" && [[ $onegate_proxy_route_missing == "yes" ]]
}
}

0 comments on commit f1bdbb6

Please sign in to comment.