osbuilder: ubuntu: Abort if multistrap fails (but not on 20.04)

We have gotten Ubuntu 20.04 working pretty much "by luck", as multistrap
fails the deployment, and then a hacky function was introduced to add
the proper dbus links.  However, this does not scale at all, and we
should:
* Fail if multistrap fails
  * I won't do this for Ubuntu 20.04 as it's working for now and soon
    enough it'll be EOL
* Add better logging to ensure someone can know when multistrap fails

Below you can find the failure that we're hitting on Ubuntu 20.04:
```sh
Errors were encountered while processing:
 dbus
ERR: dpkg configure reported an error.
Native mode configuration reported an error!
I: Tidying up apt cache and list data.

Multistrap system reported 1 error in /rootfs/.
I: Tidying up apt cache and list data.
```

Signed-off-by: Fabiano Fidêncio <fabiano@fidencio.org>
This commit is contained in:
Fabiano Fidêncio
2025-01-27 13:57:56 +01:00
parent 585f82f730
commit 4a66acc6f5

View File

@@ -45,7 +45,14 @@ EOF
apt update
if ! multistrap -a "$DEB_ARCH" -d "$rootfs_dir" -f "$multistrap_conf"; then
build_dbus $rootfs_dir
if [ "$OS_VERSION" = "focal" ]; then
echo "WARN: multistrap failed, proceed with hack for Ubuntu 20.04"
build_dbus $rootfs_dir
else
echo "ERROR: multistrap failed, cannot proceed" && exit 1
fi
else
echo "INFO: multistrap succeeded"
fi
rm -rf "$rootfs_dir/var/run"
ln -s /run "$rootfs_dir/var/run"