From 0aaf988c485bd1282192f498d405028bb1f6d929 Mon Sep 17 00:00:00 2001 From: deajan Date: Tue, 7 Feb 2017 22:13:52 +0100 Subject: [PATCH] check for sudo when needed --- dev/n_osync.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dev/n_osync.sh b/dev/n_osync.sh index 1a6097b..ef41f0a 100755 --- a/dev/n_osync.sh +++ b/dev/n_osync.sh @@ -4,7 +4,7 @@ PROGRAM="osync" # Rsync based two way sync engine with fault tolerance AUTHOR="(C) 2013-2017 by Orsiris de Jong" CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr" PROGRAM_VERSION=1.2-RC1+dev -PROGRAM_BUILD=2017020601 +PROGRAM_BUILD=2017020701 IS_STABLE=no # Execution order #__WITH_PARANOIA_DEBUG @@ -195,6 +195,13 @@ function CheckCurrentConfigAll { exit 1 fi fi + + if [ "$SUDO_EXEC" == "yes" ]; then + if ! type sudo > /dev/null 2>&1; then + Logger "sudo is not available. Disabling sudo mode." "WARN" + SUDO_EXEC=no + fi + fi } ###### Osync specific functions (non shared)