Skip to content

Commit bcbf2db

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 0c3d961 commit bcbf2db

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

data/systemd/anaconda-nm-disable-autocons-rhel.service

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22
ConditionKernelCommandLine=|ip
33
ConditionKernelCommandLine=|inst.ks
44
ConditionKernelCommandLine=|BOOTIF
5-
ConditionOSRelease=ID=rhel
65
Description=NetworkManager autoconnections configuration for Anaconda installation environment for RHEL
76
Before=NetworkManager.service
87

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

scripts/anaconda-nm-disable-autocons

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
1-
#!/bin/sh
1+
#!/bin/bash
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)