Skip to content

Commit

Permalink
network: update NM autoconnections configuration for centos
Browse files Browse the repository at this point in the history
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
  • Loading branch information
rvykydal committed Feb 28, 2025
1 parent 4a8bc61 commit 48e3be5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
3 changes: 1 addition & 2 deletions data/systemd/anaconda-nm-disable-autocons-rhel.service
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
[Unit]
ConditionKernelCommandLine=|ip
ConditionKernelCommandLine=|inst.ks
ConditionOSRelease=ID=rhel
Description=NetworkManager autoconnections configuration for Anaconda installation environment for RHEL
Before=NetworkManager.service

[Service]
Type=oneshot
ExecStart=/usr/bin/anaconda-nm-disable-autocons
ExecStart=/usr/bin/anaconda-nm-disable-autocons rhel
11 changes: 11 additions & 0 deletions scripts/anaconda-nm-disable-autocons
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
#!/bin/sh

# Disable only on system with rhel policy (RHEL, CentOS, Alma Linux, Rocky Linux, ...)
if [ "$1" == "rhel" ]; then
source /etc/os-release
if [[ ! "${ID}" == "rhel" ]] && [[ ! "${ID}" == "centos" ]] && [[ ! "${ID_LIKE}" =~ "rhel" ]]; then
echo "Skipping the RHEL NM autoconnections policy setting on system with ID: ${ID}, ID_LIKE: ${ID_LIKE}."
exit 0
fi
fi

echo "Disabling NetworkManager autoconnections."
cat > /etc/NetworkManager/conf.d/90-anaconda-no-auto-default.conf << EOF
[main]
no-auto-default=*
Expand Down

0 comments on commit 48e3be5

Please sign in to comment.