From 147c12b31fbb8f91d9e827570b36e4e21f73a143 Mon Sep 17 00:00:00 2001 From: Thomas-Nedap <51325023+Thomas-Nedap@users.noreply.github.com> Date: Mon, 4 Nov 2019 10:20:59 +0100 Subject: [PATCH] rectify install path for toolbox install (#113) * 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 --- install-toolbox | 9 +++++++++ toolbox | 3 +++ 2 files changed, 12 insertions(+) diff --git a/install-toolbox b/install-toolbox index e4670ef9..99499a01 100644 --- a/install-toolbox +++ b/install-toolbox @@ -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 @@ -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 diff --git a/toolbox b/toolbox index 23d0871a..19a2634a 100644 --- a/toolbox +++ b/toolbox @@ -1,3 +1,6 @@ source ~/.toolbox/sem-version source ~/.toolbox/libcheckout source ~/.toolbox/libchecksum +if [[ -f ~/.semaphoreci_profile ]]; then + source ~/.semaphoreci_profile + fi