From eac842d3429a7054e5bb4c9656d04d400e2bdc9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sawicz=20=28Saviq=29?= Date: Thu, 12 Oct 2023 14:31:49 +0200 Subject: [PATCH] snap: use `snapctl model` to determine if Classic --- snap/hooks/install | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/snap/hooks/install b/snap/hooks/install index fbf7653..020cb7c 100755 --- a/snap/hooks/install +++ b/snap/hooks/install @@ -11,8 +11,9 @@ snapctl stop --disable "$SNAP_INSTANCE_NAME.daemon" daemon=$(snapctl get daemon) if [ "$daemon" = "" ] then - if grep -q -e snap_core= -e snapd_recovery_mode= /proc/cmdline - then snapctl set daemon=true - else snapctl set daemon=false + # if no model at all, it's either classic or something is wrong + if ! snapctl model > /dev/null || [ "$( snapctl model | awk '/^classic:/ { print $2 }' )" == "true" ] + then snapctl set daemon=false + else snapctl set daemon=true fi fi