mirror of
https://git.launchpad.net/livecd-rootfs
synced 2025-02-10 04:37:29 +00:00
The unminimize script will try to install the lxd snap using the shim script `/usr/sbin/lxd` from the lxd-installer package. Previously `unminimize` was using `snap` to install `lxd` directly which was being diverted by diverting the `snap` command. This is no longer the case so we can remove `/usr/sbin/lxd` from the lxd-installer package if it exists and then redirect any calls to `/usr/sbin/lxd` to `/bin/true` This is a cherry pick forward port from Jammy livecd-rootfs version 2.765.37. (cherry picked from commit 8b83212372e0c1adb1dbdf7ead234f93c52a189e)
44 lines
1.7 KiB
Bash
Executable File
44 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -ex
|
|
|
|
case ${PASS} in
|
|
ubuntu-server-minimal.ubuntu-server)
|
|
;;
|
|
*)
|
|
exit 0
|
|
;;
|
|
esac
|
|
|
|
# The unminimize script will try to install the lxd snap using the shim script
|
|
# /usr/sbin/lxd from the lxd-installer package.
|
|
# We can't do that at this stage so just neuter the lxd command (the snap
|
|
# will get properly seeded by generic machinery).
|
|
if [ -f "/usr/sbin/lxd" ]; then
|
|
dpkg-divert --add --divert /usr/sbin/lxd.REAL --rename /usr/sbin/lxd
|
|
ln -s /bin/true /usr/sbin/lxd
|
|
yes | /usr/local/sbin/unminimize
|
|
# unminimize also uninstalls lxd-installer package
|
|
# and also removed `/usr/sbin/lxd` as a result, so we don't need to restore, but
|
|
# we do need to remove the mock we used as part of dpkg-divert
|
|
# first we need to remove the diversion
|
|
dpkg-divert --remove --no-rename /usr/sbin/lxd
|
|
# now remove the renamed file that we originally diverted to
|
|
rm -v /usr/sbin/lxd.REAL
|
|
else
|
|
# if /usr/sbin/lxd doesn't exist then lxd-installer package isn't installed.
|
|
# Instead, we can mock the command to avoid the unminimize script failing
|
|
ln -s /bin/true /usr/sbin/lxd
|
|
yes | /usr/local/sbin/unminimize
|
|
# as the lxd-installer package was not installed and thus not removed by `unminimize`
|
|
# the mock /usr/sbin/lxd will still be present, so we need to remove it
|
|
rm -v /usr/sbin/lxd
|
|
fi
|
|
|
|
# Fix up missing recommends. Other non-layered flavors handle this in
|
|
# live-build/auto/build, but we need to do it here. Also, there are
|
|
# additional recommends missing from server-minimal that wouldn't be
|
|
# corrected by a fix to debootstrap to handle Recommends.
|
|
echo "Installing any missing recommends"
|
|
env DEBIAN_FRONTEND=noninteractive apt-get -y --fix-policy install
|