@ -15,11 +15,16 @@ esac
# We can't do that at this stage so just neuter the lxd command (the snap
# We can't do that at this stage so just neuter the lxd command (the snap
# will get properly seeded by generic machinery).
# will get properly seeded by generic machinery).
if [ -f "/usr/sbin/lxd" ]; then
if [ -f "/usr/sbin/lxd" ]; then
rm --verbose --forc e /usr/sbin/lxd
dpkg-divert --add --divert /usr/sbin/lxd.REAL --renam e /usr/sbin/lxd
ln -s /bin/true /usr/sbin/lxd
ln -s /bin/true /usr/sbin/lxd
yes | /usr/local/sbin/unminimize
yes | /usr/local/sbin/unminimize
# unminimize also uninstalls lxd-installer package
# 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
else
# if /usr/sbin/lxd doesn't exist then lxd-installer package isn't installed.
# 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
# Instead, we can mock the command to avoid the unminimize script failing