diff --git a/diskimage_builder/elements/simple-init/README.rst b/diskimage_builder/elements/simple-init/README.rst index dd131d9f..ad8dfc50 100644 --- a/diskimage_builder/elements/simple-init/README.rst +++ b/diskimage_builder/elements/simple-init/README.rst @@ -58,3 +58,13 @@ Then set your DIB env vars like this before running DIB:: DIB_INSTALLTYPE_simple_init=repo DIB_REPOLOCATION_glean=/tmp/glean DIB_REPOREF_glean=my-test-ref + +NetworkManager +-------------- + +By default, this uses the "legacy" scripts on each platform. To use +NetworkManager instead, set ``DIB_SIMPLE_INIT_NETWORKMANAGER`` to +non-zero. See the glean documentation for what the implications for +this are on each platform. + +This is currently only implemented for CentOS and Fedora platforms. diff --git a/diskimage_builder/elements/simple-init/environment.d/15-simple-init-networkmanager b/diskimage_builder/elements/simple-init/environment.d/15-simple-init-networkmanager new file mode 100644 index 00000000..3aaeaa76 --- /dev/null +++ b/diskimage_builder/elements/simple-init/environment.d/15-simple-init-networkmanager @@ -0,0 +1 @@ +export DIB_SIMPLE_INIT_NETWORKMANAGER=${DIB_SIMPLE_INIT_NETWORKMANAGER:-0} diff --git a/diskimage_builder/elements/simple-init/install.d/50-simple-init b/diskimage_builder/elements/simple-init/install.d/50-simple-init index 8e89296b..cae36b83 100755 --- a/diskimage_builder/elements/simple-init/install.d/50-simple-init +++ b/diskimage_builder/elements/simple-init/install.d/50-simple-init @@ -24,4 +24,9 @@ SCRIPTDIR=$(dirname $0) # Ensure the 8021q module is loaded so that glean can support tagged interfaces echo "8021q" >> /etc/modules -glean-install +enable_nm="" +if [[ ${DIB_SIMPLE_INIT_NETWORKMANAGER} != 0 ]]; then + enable_nm="--use-nm" +fi + +glean-install ${enable_nm} diff --git a/diskimage_builder/elements/simple-init/package-installs.yaml b/diskimage_builder/elements/simple-init/package-installs.yaml index 8690364b..ad868c0a 100644 --- a/diskimage_builder/elements/simple-init/package-installs.yaml +++ b/diskimage_builder/elements/simple-init/package-installs.yaml @@ -1,3 +1,7 @@ dhcp-client: net-tools: ifupdown: +network-scripts: + when: DIB_SIMPLE_INIT_NETWORKMANAGER = 0 +NetworkManager: + when: DIB_SIMPLE_INIT_NETWORKMANAGER != 0 diff --git a/diskimage_builder/elements/simple-init/pkg-map b/diskimage_builder/elements/simple-init/pkg-map index 906ca121..b42f33c4 100644 --- a/diskimage_builder/elements/simple-init/pkg-map +++ b/diskimage_builder/elements/simple-init/pkg-map @@ -5,7 +5,8 @@ }, "debian": { "dhcp-client": "isc-dhcp-client", - "ifupdown": "ifupdown" + "ifupdown": "ifupdown", + "NetworkManager": "network-manager" }, "gentoo": { "dhcp-client": "net-misc/dhcp", @@ -16,8 +17,16 @@ "dhcp-client": "dhcp-client" } }, + "release": { + "fedora": { + "29": { + "network-scripts": "network-scripts" + } + } + }, "default": { "dhcp-client": "isc-dhcp-client", - "ifupdown": "" + "ifupdown": "", + "network-scripts": "" } } diff --git a/diskimage_builder/elements/simple-init/post-install.d/80-simple-init b/diskimage_builder/elements/simple-init/post-install.d/80-simple-init index 898dd41b..4c5a79ae 100755 --- a/diskimage_builder/elements/simple-init/post-install.d/80-simple-init +++ b/diskimage_builder/elements/simple-init/post-install.d/80-simple-init @@ -13,9 +13,11 @@ case "$DIB_INIT_SYSTEM" in ;; systemd) if [[ ${DISTRO_NAME} =~ (centos|rhel7|fedora) ]]; then - # NOTE(pabelanger): Glean requires network.service for - # these platforms. - systemctl enable network.service + if [[ ${DIB_SIMPLE_INIT_NETWORKMANAGER} != 1 ]]; then + # NOTE(pabelanger): Glean requires network.service for + # these platforms when not using networkmanager + systemctl enable network.service + fi elif [[ ${DISTRO_NAME} =~ (opensuse) ]]; then # on suse, this is named wicked.service, but it's the same # as network.service. diff --git a/releasenotes/notes/simple-init-nm-f0896124dee92a03.yaml b/releasenotes/notes/simple-init-nm-f0896124dee92a03.yaml new file mode 100644 index 00000000..1fb86e77 --- /dev/null +++ b/releasenotes/notes/simple-init-nm-f0896124dee92a03.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + The `simple-init` element can now use NetworkManager instead of + legacy scripts on Red Hat platforms.