From 0d528ff878d725e94543856d932f4af768d23831 Mon Sep 17 00:00:00 2001 From: Maarten van Gompel Date: Sun, 25 Jul 2021 14:19:42 +0200 Subject: [PATCH] fallback to no rtcwake in case of missing mnc rather than having a broken crust Though we'll ship and install mnc by default, we already someone run into this, so best make the script a bit more robust. Signed-off-by: Stacy Harper --- scripts/core/sxmo_screenlock.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/core/sxmo_screenlock.sh b/scripts/core/sxmo_screenlock.sh index 0bf9c66..4e2226c 100755 --- a/scripts/core/sxmo_screenlock.sh +++ b/scripts/core/sxmo_screenlock.sh @@ -151,10 +151,13 @@ elif [ "$1" = "crust" ] ; then #turn screen off xset dpms force off - suspend_time="$(($(mnc)-10))" YEARS8_TO_SEC=268435455 - if [ "$suspend_time" -gt "$YEARS8_TO_SEC" ]; then + if command -v mnc > /dev/null; then + #wake up 10 seconds before the next cron event + suspend_time="$(($(mnc)-10))" + fi + if [ -z "$suspend_time" ] || [ "$suspend_time" -gt "$YEARS8_TO_SEC" ]; then suspend_time="$YEARS8_TO_SEC" fi if [ "$suspend_time" -gt 0 ]; then