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

detect ms win; load env file

parent 5d677afa
No related branches found
No related tags found
1 merge request!95ignore required user on MS windows
...@@ -42,6 +42,11 @@ STORAGEFILE="${DIR_JOBS}/transfer.job" ...@@ -42,6 +42,11 @@ STORAGEFILE="${DIR_JOBS}/transfer.job"
function j_init(){ function j_init(){
j_banner j_banner
if [ -r "${DIR_JOBS}/env" ];
then
echo "INFO: loading custom environment ${DIR_JOBS}/env"
. "${DIR_JOBS}/env"
fi
if [ ! -d "${DIR_LOGS}" ]; then if [ ! -d "${DIR_LOGS}" ]; then
mkdir -p "${DIR_LOGS}" && echo "INFO: dir created ${DIR_LOGS}" mkdir -p "${DIR_LOGS}" && echo "INFO: dir created ${DIR_LOGS}"
...@@ -374,21 +379,28 @@ function j_requireProcess(){ ...@@ -374,21 +379,28 @@ function j_requireProcess(){
fi fi
} }
# detect ms windows by cygwin, mingw, msys ...
# see https://en.wikipedia.org/wiki/Uname
# return code is 0 for YES
function _isMswindows(){
uname | grep -iE "(CYGWIN_NT|MINGW|MSYS_NT|Windows_NT|WindowsNT)" >/dev/null
}
# ------------------------------------------------------------ # ------------------------------------------------------------
# check if it was startet with a given user # check if it was startet with a given user
# This is skipped if MS windows was detected with "mingw". # This is skipped if MS windows was detected with "mingw".
# param string username, i.e. root # param string username, i.e. root
# ------------------------------------------------------------ # ------------------------------------------------------------
function j_requireUser(){ function j_requireUser(){
# TODO: this is an incomplete check. Check more strings eg. cygwin if _isMswindows; then
if uname | grep -iE "mingw" >/dev/null; then echo "SKIP: j_requireUser $1 is not handled on MS Windows."
return 0 else
fi
sUser=$(id | cut -f 2 -d "(" | cut -f 1 -d ")") sUser=$(id | cut -f 2 -d "(" | cut -f 1 -d ")")
if [[ "$sUser" != "$1" ]]; then if [[ "$sUser" != "$1" ]]; then
>&2 echo "ERROR: user $1 is reqired." >&2 echo "ERROR: user $1 is reqired."
exit 5 exit 5
fi fi
fi
} }
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment