Skip to content
Snippets Groups Projects
Commit 5d677afa authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

ignore required user on MS windows

parent d46061c8
No related branches found
No related tags found
1 merge request!95ignore required user on MS windows
......@@ -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."
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment