From 246cde406c2244847327801e6c3c2cde4260ba8c Mon Sep 17 00:00:00 2001
From: "Hahn Axel (hahn)" <axel.hahn@iml.unibe.ch>
Date: Thu, 31 Mar 2022 17:20:27 +0200
Subject: [PATCH] restore: detect non-root earlier

---
 restore.sh | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/restore.sh b/restore.sh
index 4e5ac24..99fce00 100755
--- a/restore.sh
+++ b/restore.sh
@@ -36,10 +36,17 @@
 
   # --- load a transfer plugin
   STORAGE_BIN=`_j_getvar ${STORAGEFILE} "bin"`
+
   if [ -z "$STORAGE_BIN" ]; then
-    # STORAGE_BIN=restic
-    STORAGE_BIN=duplicity
+    if ! id -u | grep '^0$'
+    then
+      cecho error "ERROR: Maybe you need root permissions to start $0"
+    else
+      cecho error "ERROR: missing config bin = ... for file transfer."
+    fi
+    exit 1
   fi
+
   CFGPREFIX=${STORAGE_BIN}_
 
   . `dirname $0`/plugins/transfer/$STORAGE_BIN.sh || exit 1
-- 
GitLab