Skip to content

Commit

Permalink
rectify install path for toolbox install (#113)
Browse files Browse the repository at this point in the history
* rectify install path for toolbox install

INSTALL_PATH is now reset after the platform check is finished, creating
the missing folder with it if need be. This also keeps the INSTALL_PATH
changes isolated to the top section, leaving the install_cmd to smaller set of things to do.

the command was not run for the container environment thus
not adding links to the tools anymore so this introduces it back

finally, to avoid adding multiple times the install path in the PATH a
quick grep check on the profile will limit runs to only once

* add touch on profile file to insure grep will work

* add profile source to load path
  • Loading branch information
Thomas-Nedap authored and CommanderK5 committed Nov 4, 2019
1 parent 7abb4ee commit 147c12b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions install-toolbox
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ case $DIST in
;;
esac

if [ $SEMAPHORE_AGENT_MACHINE_ENVIRONMENT_TYPE == "container" ]; then
INSTALL_PATH="$HOME/.semaphoreci_bin"
mkdir -p $INSTALL_PATH
fi

cat << EOF >> ~/.ssh/config
Host github.com bitbucket.org
StrictHostKeyChecking no
Expand All @@ -28,6 +33,10 @@ install_cmd() {
local cmd=$@
if [ `whoami` == 'root' ]; then
`$@`
elif [[ $SEMAPHORE_AGENT_MACHINE_ENVIRONMENT_TYPE == "container" ]]; then
touch ~/.semaphoreci_profile
[ "`grep -c semaphoreci ~/.semaphoreci_profile`" -eq 0 ] && echo "export PATH=\"\$PATH:$INSTALL_PATH\"" >> ~/.semaphoreci_profile
`$@`
else
`sudo $@`
fi
Expand Down
3 changes: 3 additions & 0 deletions toolbox
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
source ~/.toolbox/sem-version
source ~/.toolbox/libcheckout
source ~/.toolbox/libchecksum
if [[ -f ~/.semaphoreci_profile ]]; then
source ~/.semaphoreci_profile
fi

0 comments on commit 147c12b

Please sign in to comment.