Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
iml-backup
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IML Open Source
iml-backup
Commits
14d0bd5b
Commit
14d0bd5b
authored
2 years ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
detect ms win; load env file
parent
5d677afa
No related branches found
No related tags found
1 merge request
!95
ignore required user on MS windows
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
jobhelper.sh
+20
-8
20 additions, 8 deletions
jobhelper.sh
with
20 additions
and
8 deletions
jobhelper.sh
+
20
−
8
View file @
14d0bd5b
...
...
@@ -42,6 +42,11 @@ STORAGEFILE="${DIR_JOBS}/transfer.job"
function
j_init
(){
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
mkdir
-p
"
${
DIR_LOGS
}
"
&&
echo
"INFO: dir created
${
DIR_LOGS
}
"
...
...
@@ -374,20 +379,27 @@ function j_requireProcess(){
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
# 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. cygwi
n
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."
exit
5
if
_isMswindows
;
the
n
echo
"SKIP: j_requireUser
$1
is not handled on MS Windows."
else
sUser
=
$(
id
|
cut
-f
2
-d
"("
|
cut
-f
1
-d
")"
)
if
[[
"
$sUser
"
!=
"
$1
"
]]
;
then
>
&2
echo
"ERROR: user
$1
is reqired."
exit
5
fi
fi
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment