Skip to content

Commit 48e3be5

Browse files
committed
network: update NM autoconnections configuration for centos
The policy should be the same for RHEL and CentOS Stream. Apply also to rhel-like systems. We can use systemd mechanism using triggering conditions either for kernel option parsing or for system detection. It seems that systemd would be better serving here for the kernel option conditions, os detection seems to be more feasible on our side inside the service execution script. Resolves: RHEL-67815
1 parent 4a8bc61 commit 48e3be5

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
[Unit]
22
ConditionKernelCommandLine=|ip
33
ConditionKernelCommandLine=|inst.ks
4-
ConditionOSRelease=ID=rhel
54
Description=NetworkManager autoconnections configuration for Anaconda installation environment for RHEL
65
Before=NetworkManager.service
76

87
[Service]
98
Type=oneshot
10-
ExecStart=/usr/bin/anaconda-nm-disable-autocons
9+
ExecStart=/usr/bin/anaconda-nm-disable-autocons rhel

scripts/anaconda-nm-disable-autocons

+11
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
11
#!/bin/sh
2+
3+
# Disable only on system with rhel policy (RHEL, CentOS, Alma Linux, Rocky Linux, ...)
4+
if [ "$1" == "rhel" ]; then
5+
source /etc/os-release
6+
if [[ ! "${ID}" == "rhel" ]] && [[ ! "${ID}" == "centos" ]] && [[ ! "${ID_LIKE}" =~ "rhel" ]]; then
7+
echo "Skipping the RHEL NM autoconnections policy setting on system with ID: ${ID}, ID_LIKE: ${ID_LIKE}."
8+
exit 0
9+
fi
10+
fi
11+
12+
echo "Disabling NetworkManager autoconnections."
213
cat > /etc/NetworkManager/conf.d/90-anaconda-no-auto-default.conf << EOF
314
[main]
415
no-auto-default=*

0 commit comments

Comments
 (0)