Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

Support ID_LIKE in /etc/os-release if it exists #286

Merged
merged 2 commits into from
Apr 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 29 additions & 26 deletions src/etc/one-context.d/loc-10-network
Original file line number Diff line number Diff line change
Expand Up @@ -29,32 +29,35 @@ if [ -z "${action}" ] ; then
fi

if [ -z "${NETCFG_TYPE}" ] ; then
case "${os_id}" in
alpine)
NETCFG_TYPE='interfaces'
;;
altlinux)
NETCFG_TYPE='networkd nm'
;;
debian|devuan|ubuntu)
NETCFG_TYPE='interfaces netplan nm networkd'
;;
fedora|centos|rhel|almalinux|ol|rocky)
NETCFG_TYPE='scripts nm networkd'
;;
opensuse*|sles|sled)
NETCFG_TYPE='scripts'
;;
amzn)
NETCFG_TYPE='scripts'
;;
freebsd)
NETCFG_TYPE='bsd'
;;
*)
NETCFG_TYPE='none'
;;
esac
for id in ${os_id}; do
case "${id}" in
codyro marked this conversation as resolved.
Show resolved Hide resolved
alpine)
NETCFG_TYPE='interfaces'
;;
altlinux)
NETCFG_TYPE='networkd nm'
;;
debian|devuan|ubuntu)
NETCFG_TYPE='interfaces netplan nm networkd'
;;
fedora|centos|rhel|almalinux|ol|rocky)
NETCFG_TYPE='scripts nm networkd'
;;
opensuse*|sles|sled)
NETCFG_TYPE='scripts'
;;
amzn)
NETCFG_TYPE='scripts'
;;
freebsd)
NETCFG_TYPE='bsd'
;;
*)
NETCFG_TYPE='none'
;;
esac
break
done
else
# trim and lowercase
NETCFG_TYPE=$(echo "$NETCFG_TYPE" | \
Expand Down
3 changes: 2 additions & 1 deletion src/etc/one-context.d/loc-10-network.d/functions
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,10 @@ detect_os()
(
if [ -f /etc/os-release ] ; then
ID=
ID_LIKE=
# shellcheck disable=SC1091
. /etc/os-release
echo "$ID" | tr '[:upper:]' '[:lower:]'
echo "$ID $ID_LIKE" | tr '[:upper:]' '[:lower:]'

# check for legacy RHEL/CentOS 6
elif [ -f /etc/centos-release ]; then
Expand Down