bin/console-conf-wrapper: prefer use of snapd/modeenv when determining snapd mode

Signed-off-by: Ondrej Kubik <ondrej.kubik@canonical.com>
This commit is contained in:
Ondrej Kubik 2023-04-13 18:50:27 +01:00
parent 919ca5ebd4
commit f55f2fc94a
1 changed files with 8 additions and 1 deletions

View File

@ -22,7 +22,14 @@ if [ -e /run/snapd-recovery-chooser-triggered ]; then
fi
fi
if grep -q 'snapd_recovery_mode=install' /proc/cmdline ; then
# always prefer to use modeevn if it is available
if [ -e "/var/lib/snapd/modeenv" ]; then
mode="$(sed -n 's/mode=\([^[:space:]]*\)/\1/p' /var/lib/snapd/modeenv)"
else
mode="$(sed 's/.*snapd_recovery_mode=\([^[:space:]]*\)[[:space:]].*/\1/' /proc/cmdline))"
fi
if [ "${mode}" = "install" ]; then
echo "Installing the system, please wait for reboot"
# XXX: replace with something more user friendly after the beta?
journalctl -u snapd.service -f