fix: Fix calls to `unminimize` if lxd-installer package not present (LP: #2049723)

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`.
allwinner-kernel-jammy
Philip Roche 11 months ago
parent 8a59f9d4ee
commit 34dea62ef0

6
debian/changelog vendored

@ -1,3 +1,9 @@
livecd-rootfs (2.765.37) jammy; urgency=medium
* fix: Fix for calling unminimize if lxd-installer package not installed. (LP: #2049723)
-- Philip Roche <phil.roche@canonical.com> Mon, 22 Jan 2024 13:26:43 +0000
livecd-rootfs (2.765.36) jammy; urgency=medium livecd-rootfs (2.765.36) jammy; urgency=medium
* Use correct /etc/ssh/sshd_config.d/ filename so cloud-init overrides * Use correct /etc/ssh/sshd_config.d/ filename so cloud-init overrides

@ -10,11 +10,22 @@ case ${PASS} in
;; ;;
esac esac
# The unminimize script will try to install the lxd snap. We can't # The unminimize script will try to install the lxd snap using the shim script
# do that at this stage so just neuter the snap command (the snap # /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). # will get properly seeded by generic machinery).
dpkg-divert --add --divert /usr/bin/snap.REAL --rename /usr/bin/snap if [[ -f "/usr/sbin/lxd" ]]; then
ln -s /bin/true /usr/bin/snap rm --verbose --force /usr/sbin/lxd
ln -s /bin/true /usr/sbin/lxd
yes | /usr/local/sbin/unminimize yes | /usr/local/sbin/unminimize
rm /usr/bin/snap # unminimize also uninstalls lxd-installer package
dpkg-divert --remove --rename /usr/bin/snap # and also removed `/usr/sbin/lxd` as a result so we don't need to restore
else
# if /usr/sbin/lxd doesn't exist when lxd-installer package isn't installed so 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 the mock
# /usr/sbin/lxd will still be present so we need to remove it
rm --verbose --force /usr/sbin/lxd
fi
Loading…
Cancel
Save