From 5d677afa17d6bc7e4b378b186a44b58a541c69d5 Mon Sep 17 00:00:00 2001 From: "Hahn Axel (hahn)" <axel.hahn@unibe.ch> Date: Thu, 16 Mar 2023 17:24:16 +0100 Subject: [PATCH] ignore required user on MS windows --- jobhelper.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/jobhelper.sh b/jobhelper.sh index 5106239..9d73c94 100755 --- a/jobhelper.sh +++ b/jobhelper.sh @@ -5,7 +5,7 @@ # helper script to share functions for parsing and handlinmg backup jobs # # -------------------------------------------------------------------------------- -# ah - Axel Hahn <axel.hahn@iml.unibe.ch> +# ah - Axel Hahn <axel.hahn@unibe.ch> # ds - Daniel Schueler <daniel.schueler@iml.unibe.ch> # # 2016-11-10 ah,ds v1.0 @@ -13,6 +13,7 @@ # 2017-02-16 ah,ds v1.2 added storage helper function # 2018-02-13 ah,ds v1.3 detect samba shares based on a flag # 2022-10-07 ah v1.4 unescape regex with space to prevent "grep: warning: stray \ before white space" +# 2023-03-16 ah v1.5 ignore required user on MS windows # ================================================================================ @@ -375,9 +376,14 @@ function j_requireProcess(){ # ------------------------------------------------------------ # check if it was startet with a given user +# This is skipped if MS windows was detected with "mingw". # param string username, i.e. root # ------------------------------------------------------------ function j_requireUser(){ + # TODO: this is an incomplete check. Check more strings eg. cygwin + if uname | grep -iE "mingw" >/dev/null; then + return 0 + fi sUser=$(id | cut -f 2 -d "(" | cut -f 1 -d ")") if [[ "$sUser" != "$1" ]]; then >&2 echo "ERROR: user $1 is reqired." -- GitLab