This repository was archived by the owner on Jan 16, 2024. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,36 +28,34 @@ if [ -z "${action}" ] ; then
2828 action=" configure"
2929fi
3030
31+ # update detect_os function if new distro is added
3132if [ -z " ${NETCFG_TYPE} " ] ; then
32- for id in ${os_id} ; do
33- case " ${id} " in
34- alpine)
35- NETCFG_TYPE=' interfaces'
36- ;;
37- altlinux)
38- NETCFG_TYPE=' networkd nm'
39- ;;
40- debian|devuan|ubuntu)
41- NETCFG_TYPE=' interfaces netplan nm networkd'
42- ;;
43- fedora|centos|rhel|almalinux|ol|rocky)
44- NETCFG_TYPE=' scripts nm networkd'
45- ;;
46- opensuse* |sles|sled)
47- NETCFG_TYPE=' scripts'
48- ;;
49- amzn)
50- NETCFG_TYPE=' scripts'
51- ;;
52- freebsd)
53- NETCFG_TYPE=' bsd'
54- ;;
55- * )
56- NETCFG_TYPE=' none'
57- ;;
58- esac
59- break
60- done
33+ case " ${os_id} " in
34+ alpine)
35+ NETCFG_TYPE=' interfaces'
36+ ;;
37+ altlinux)
38+ NETCFG_TYPE=' networkd nm'
39+ ;;
40+ debian|devuan|ubuntu)
41+ NETCFG_TYPE=' interfaces netplan nm networkd'
42+ ;;
43+ fedora|centos|rhel|almalinux|ol|rocky)
44+ NETCFG_TYPE=' scripts nm networkd'
45+ ;;
46+ opensuse* |sles|sled)
47+ NETCFG_TYPE=' scripts'
48+ ;;
49+ amzn)
50+ NETCFG_TYPE=' scripts'
51+ ;;
52+ freebsd)
53+ NETCFG_TYPE=' bsd'
54+ ;;
55+ * )
56+ NETCFG_TYPE=' none'
57+ ;;
58+ esac
6159else
6260 # trim and lowercase
6361 NETCFG_TYPE=$( echo " $NETCFG_TYPE " | \
Original file line number Diff line number Diff line change @@ -199,9 +199,21 @@ detect_os()
199199 if [ -f /etc/os-release ] ; then
200200 ID=
201201 ID_LIKE=
202+ LINUX_ID=
202203 # shellcheck disable=SC1091
203204 . /etc/os-release
204- echo " $ID $ID_LIKE " | tr ' [:upper:]' ' [:lower:]'
205+
206+ case " $ID " in
207+ # supported distros
208+ alpine|altlinux|debian|devuan|ubuntu|fedora|centos|rhel|almalinux|ol|rocky|opensuse* |sles|sled|amzn|freebsd)
209+ LINUX_ID=$ID
210+ ;;
211+ * )
212+ LINUX_ID=$ID_LIKE
213+ ;;
214+ esac
215+
216+ echo " $LINUX_ID " | tr ' [:upper:]' ' [:lower:]'
205217
206218 # check for legacy RHEL/CentOS 6
207219 elif [ -f /etc/centos-release ]; then
You can’t perform that action at this time.
0 commit comments