bin/console-conf-wrapper: detect whether snapd recovery chooser should run

Look for the marker file left by snapd recovery chooser user request detection
and attempt to run the chooser.

Signed-off-by: Maciek Borzecki <maciek.borzecki@gmail.com>
This commit is contained in:
Maciek Borzecki 2020-02-21 17:30:39 +01:00
parent 5cc407bfcd
commit fc09279772
1 changed files with 9 additions and 0 deletions

View File

@ -10,6 +10,15 @@ trap echo_on EXIT
# happened and need to force it on. Yay UNIX! # happened and need to force it on. Yay UNIX!
stty icrnl -echo stty icrnl -echo
if [ -e /run/snapd-recovery-chooser-triggered ]; then
# make sure the chooser binary is there to avoid getting into an awkward
# state and locking out the user
if [ -x /usr/lib/snapd/snap-recovery-chooser ]; then
# when recovery chooser is invoked it takes over the terminal
exec /usr/lib/snapd/snap-recovery-chooser
fi
fi
if [ "$(snap managed)" = "true" ]; then if [ "$(snap managed)" = "true" ]; then
# check if we have extrausers that have no password set # check if we have extrausers that have no password set
if grep -qE '^[-a-z0-9+.-_]+:x:' /var/lib/extrausers/passwd && ! grep -qE '^[-a-z0-9+.-_]+:\$[0-9]+\$.*:' /var/lib/extrausers/shadow; then if grep -qE '^[-a-z0-9+.-_]+:x:' /var/lib/extrausers/passwd && ! grep -qE '^[-a-z0-9+.-_]+:\$[0-9]+\$.*:' /var/lib/extrausers/shadow; then