From 335f8dc6fddc6b6eed12f806ea57353d1bae5088 Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Mon, 14 Aug 2023 14:49:38 +0200 Subject: [PATCH] Change default value of DIB_DEBIAN_ALT_INIT_PACKAGE For quite a while Debian is shipped with systemd-sysv by default. However, default value of DIB_DEBIAN_ALT_INIT_PACKAGE is not in sync across elements. We change a default now for the `debian` element along with removing `apt_get_bp_extra_opts` that is not defined or used anywhere else. Change-Id: If5d3f0a21467f926c23bb39a1853be73befa768e --- .../elements/debian/install.d/10-cloud-opinions | 16 +++++++++++----- ...lt_deb_init_per_release-f5a7451b0c2704c9.yaml | 9 +++++++++ 2 files changed, 20 insertions(+), 5 deletions(-) create mode 100644 releasenotes/notes/default_deb_init_per_release-f5a7451b0c2704c9.yaml diff --git a/diskimage_builder/elements/debian/install.d/10-cloud-opinions b/diskimage_builder/elements/debian/install.d/10-cloud-opinions index 8693f085..5ecc3d26 100755 --- a/diskimage_builder/elements/debian/install.d/10-cloud-opinions +++ b/diskimage_builder/elements/debian/install.d/10-cloud-opinions @@ -20,8 +20,14 @@ if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then fi set -eu set -o pipefail - -DIB_DEBIAN_ALT_INIT_PACKAGE=${DIB_DEBIAN_ALT_INIT_PACKAGE:-sysvinit} +case "${DIB_RELEASE}" in + hamm|slink|potato|woody|sarge|etch|lenny|squeeze|wheezy) + DIB_DEBIAN_ALT_INIT_PACKAGE=${DIB_DEBIAN_ALT_INIT_PACKAGE:-sysvinit} + ;; + *) + DIB_DEBIAN_ALT_INIT_PACKAGE=${DIB_DEBIAN_ALT_INIT_PACKAGE:-systemd-sysv} + ;; +esac adduser --gecos Debian-cloud-init-user --disabled-password --quiet debian @@ -32,9 +38,9 @@ chmod 0440 /etc/sudoers.d/debian-cloud-init if [ "$DIB_DEBIAN_ALT_INIT_PACKAGE" != "sysvinit" ]; then # To avoid a conflict against an essential package, we need to remove sysvinit first dpkg --purge --force remove-essential sysvinit - apt-get install -y $apt_get_bp_extra_opts $DIB_DEBIAN_ALT_INIT_PACKAGE - printf \"Package: sysvinit\nPin: origin ""\nPin-Priority: -1\n\" > \ - /etc/apt/preferences.d/sysvinit > /etc/apt/preferences.d/sysvinit + apt-get install -y $DIB_DEBIAN_ALT_INIT_PACKAGE + printf "Package: sysvinit\nPin: origin \"\"\nPin-Priority: -1\n" > \ + /etc/apt/preferences.d/sysvinit fi case "${DIB_RELEASE}" in diff --git a/releasenotes/notes/default_deb_init_per_release-f5a7451b0c2704c9.yaml b/releasenotes/notes/default_deb_init_per_release-f5a7451b0c2704c9.yaml new file mode 100644 index 00000000..f1928996 --- /dev/null +++ b/releasenotes/notes/default_deb_init_per_release-f5a7451b0c2704c9.yaml @@ -0,0 +1,9 @@ +--- + +other: + - | + Value of ``DIB_DEBIAN_ALT_INIT_PACKAGE`` has been switched to + ``systemd-sysv`` for Debian releases older then Jessie. + If you still need to build a version of Debian that is relying + on ``sysvinit`` please override the ``DIB_DEBIAN_ALT_INIT_PACKAGE`` + variable for that.