Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
Imldeployment
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
Imldeployment
Commits
1b919c6c
Commit
1b919c6c
authored
9 months ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
goto-build: deny root access; shell fixes
parent
ed372974
Branches
Branches containing commit
No related tags found
1 merge request
!64
Update readme + docs
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
shellscripts/goto_build_dir.sh
+13
-5
13 additions, 5 deletions
shellscripts/goto_build_dir.sh
with
13 additions
and
5 deletions
shellscripts/goto_build_dir.sh
+
13
−
5
View file @
1b919c6c
...
...
@@ -7,9 +7,10 @@
#
# ----------------------------------------------------------------------
# 2024-01-19 v1.0 <axel.hahn@iml.unibe.ch> first lines
# 2024-07-25 v1.1 <axel.hahn@iml.unibe.ch> deny root access; shell fixes
# ======================================================================
cd
$(
dirname
$0
)
/..
cd
"
$(
dirname
"
$0
"
)
/..
"
||
exit
1
CI_APPROOT
=
$(
pwd
)
# ----------------------------------------------------------------------
...
...
@@ -24,6 +25,14 @@ cat <<HEADEREND
HEADEREND
# ----------------------------------------------------------------------
# deny start as root
# ----------------------------------------------------------------------
if
[
"
$(
id
-u
)
"
-eq
0
]
;
then
echo
"ERROR: do not start this script as root."
exit
1
fi
# ----------------------------------------------------------------------
# detect workdir
# ----------------------------------------------------------------------
...
...
@@ -42,9 +51,9 @@ builddir="$CI_WORKDIR/build/"
# detect builds on error
# ----------------------------------------------------------------------
ls
$builddir
>
/dev/null
||
exit
1
ls
"
$builddir
"
>
/dev/null
||
exit
1
echo
"Searching for builds im
$builddir
..."
founddirs
=
$(
find
$builddir
-maxdepth
2
-type
d |
grep
'2[0-1][0-9][0-9][0-1][0-9][0-3][0-9]'
|
sort
)
founddirs
=
$(
find
"
$builddir
"
-maxdepth
2
-type
d |
grep
'2[0-1][0-9][0-9][0-1][0-9][0-3][0-9]'
|
sort
)
if
[
-z
"
$founddirs
"
]
;
then
echo
"Good news: No build dirs (builds on error) were found. Aborting."
...
...
@@ -69,7 +78,6 @@ echo -n "I want to jump to > "
read
-r
DIR_APPROOT
test
-z
"
$DIR_APPROOT
"
&&
exit
1
# DIR_APPROOT="/var/imldeployment/build/$DIR_APPROOT"
ls
"
$DIR_APPROOT
"
>
/dev/null
||
exit
2
# ----------------------------------------------------------------------
...
...
@@ -82,7 +90,7 @@ export DIR_SSH_KEYS="$CI_WORKDIR/data/sshkeys"
export
NVMINIT
=
"
$CI_APPROOT
/shellscripts/nvm_init.sh"
;
export
RVMSCRIPT
=
"/usr/local/rvm/scripts/rvm"
;
cd
"
$DIR_APPROOT
"
cd
"
$DIR_APPROOT
"
||
exit
1
cat
<<
EOF
* Switching now into build dir
...
...
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