From 1ec1f3988f90ba9516b26297bcaddaff8f343cf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20Sch=C3=A4fer?= Date: Mon, 5 Aug 2024 11:30:14 +0200 Subject: [PATCH] Fix Ubuntu box build Add post_bootstrap.sh and make sure the package scripts for passwd-base run. Depending on what other packages gets installed it might be required to enter the system package installation with a proper setup because otherwise package scripts from other packages will fail. We might consider to add this code into kiwi though --- boxes/ubuntu/appliance.kiwi | 13 +++++++------ boxes/ubuntu/post_bootstrap.sh | 31 +++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 6 deletions(-) create mode 100644 boxes/ubuntu/post_bootstrap.sh diff --git a/boxes/ubuntu/appliance.kiwi b/boxes/ubuntu/appliance.kiwi index 3b09644..9bf70be 100644 --- a/boxes/ubuntu/appliance.kiwi +++ b/boxes/ubuntu/appliance.kiwi @@ -106,14 +106,15 @@ + + + + + + + - - - - - - diff --git a/boxes/ubuntu/post_bootstrap.sh b/boxes/ubuntu/post_bootstrap.sh new file mode 100644 index 0000000..264687f --- /dev/null +++ b/boxes/ubuntu/post_bootstrap.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +set -ex + +# Intermediate C locale setup +export LANG=C.UTF-8 +export LANGUAGE= + +# Intermediate Noninteractive debconf +echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections + +# Download packages for which we need the script code +apt-get -q -c /kiwi_apt.conf -y --no-install-recommends install \ + "-oDebug::pkgDPkgPm=1" "-oDPkg::Pre-Install-Pkgs::=cat >/tmp/postpacks" \ +base-passwd + +# Run package scripts for core OS packages which provides +# mandatory setup code in their pre/post scripts +export DPKG_ROOT=/ +while read -r package;do + pushd "$(dirname "${package}")" || exit 1 + if [ "$(basename "${package}")" = "base-passwd.deb" ];then + # Required to create passwd, groups, the root user... + dpkg -e "${package}" + test -e DEBIAN/preinst && bash DEBIAN/preinst install + test -e DEBIAN/postinst && bash DEBIAN/postinst + rm -rf DEBIAN + fi + popd || exit 1 +done < /tmp/postpacks +rm -f /tmp/postpacks