diff --git a/data/systemd/anaconda-nm-disable-autocons-rhel.service b/data/systemd/anaconda-nm-disable-autocons-rhel.service index 638693c5431..c431a87bd35 100644 --- a/data/systemd/anaconda-nm-disable-autocons-rhel.service +++ b/data/systemd/anaconda-nm-disable-autocons-rhel.service @@ -2,10 +2,9 @@ ConditionKernelCommandLine=|ip ConditionKernelCommandLine=|inst.ks ConditionKernelCommandLine=|BOOTIF -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 diff --git a/scripts/anaconda-nm-disable-autocons b/scripts/anaconda-nm-disable-autocons index 9ba3cbd8027..90855f7da82 100755 --- a/scripts/anaconda-nm-disable-autocons +++ b/scripts/anaconda-nm-disable-autocons @@ -1,4 +1,15 @@ -#!/bin/sh +#!/bin/bash + +# 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=*