From 55e9e849735306544138e6efc8895e7f50f02730 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Tue, 10 Apr 2018 12:32:02 +0100 Subject: [PATCH] Working snap user detection. --- snap/launcher.sh | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/snap/launcher.sh b/snap/launcher.sh index 40f7f732..2bc748ad 100755 --- a/snap/launcher.sh +++ b/snap/launcher.sh @@ -10,12 +10,10 @@ # that mosquitto is being run as a system daemon, and SNAP_COMMON will be used. # If a non-root user runs the command, then SNAP_USER_COMMON will be used. -if [ "$USER" = "root" ] -then - COMMON=$SNAP_COMMON -else - COMMON=$SNAP_USER_COMMON -fi +case "$SNAP_USER_COMMON" in + */root/snap/mosquitto/common*) COMMON=$SNAP_COMMON ;; + *) COMMON=$SNAP_USER_COMMON ;; +esac CONFIG_FILE="$SNAP/default_config.conf" CUSTOM_CONFIG="$COMMON/mosquitto.conf"