diff --git a/live-build/ubuntu-server/hooks/01-unminimize.chroot_early b/live-build/ubuntu-server/hooks/01-unminimize.chroot_early index cefc73c7..1265966b 100755 --- a/live-build/ubuntu-server/hooks/01-unminimize.chroot_early +++ b/live-build/ubuntu-server/hooks/01-unminimize.chroot_early @@ -15,11 +15,16 @@ esac # 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 - rm --verbose --force /usr/sbin/lxd + 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 + # 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