From: AJ ONeal Date: Tue, 5 May 2020 19:34:42 +0000 (-0600) Subject: bugfix / switch installed versions X-Git-Url: https://git.josue.xyz/?p=webi-installers%2F.git;a=commitdiff_plain;h=b560b7a53d2dbed6363d8cfce68bfffde13be34b bugfix / switch installed versions --- diff --git a/golang/install.bash b/golang/install.bash index caeea6e..a6a8592 100644 --- a/golang/install.bash +++ b/golang/install.bash @@ -41,9 +41,24 @@ set -u # Install go # ################### +common_go_home="${HOME}/.local/opt/go-v${WEBI_VERSION}" new_go_home="${HOME}/.local/opt/go-v${WEBI_VERSION}" new_go="${HOME}/.local/opt/go-v${WEBI_VERSION}/bin/go" +update_go_home() { + rm -rf "$common_go_home" + ln -s "$new_go_home" "$common_go_home" + + # TODO get better output from pathman / output the path to add as return to webi bootstrap + webi_path_add "$common_go_home/bin" + webi_path_add "$HOME/go/bin" +} + +if [ -x "$new_go_home/bin/go" ]; then + update_go_home + exit 0 +fi + # Test for existing version set +e cur_go="$(command -v go)" @@ -96,9 +111,7 @@ popd 2>&1 >/dev/null # Update PATH # ################### -# TODO get better output from pathman / output the path to add as return to webi bootstrap -webi_path_add "$new_go_home/bin" -webi_path_add "$HOME/go/bin" +update_go_home echo "Installed 'go' (and go tools)" echo "" diff --git a/node/install.bash b/node/install.bash index 251022d..6fd6852 100644 --- a/node/install.bash +++ b/node/install.bash @@ -81,9 +81,23 @@ set -u # Install node # ################## +common_node_home="${HOME}/.local/opt/node" new_node_home="${HOME}/.local/opt/node-v${WEBI_VERSION}" new_node="${HOME}/.local/opt/node-v${WEBI_VERSION}/bin/node" +update_node_home() { + rm -rf "$common_node_home" + ln -s "$new_node_home" "$common_node_home" + + # TODO get better output from pathman / output the path to add as return to webi bootstrap + webi_path_add "$common_node_home/bin" +} + +if [ -x "$new_go_home/bin/go" ]; then + update_node_home + exit 0 +fi + # Test for existing version set +e cur_node="$(command -v node)" @@ -130,8 +144,7 @@ popd 2>&1 >/dev/null # Update PATH # ################### -# TODO get better output from pathman / output the path to add as return to webi bootstrap -webi_path_add "$new_node_home/bin" +update_node_home echo "Installed 'node' and 'npm'" echo ""