mirror of
https://github.com/ViViDboarder/shoestrap.git
synced 2025-01-03 03:47:44 +00:00
Avoid reinstall of golang
This commit is contained in:
parent
cf5cdb8186
commit
17d8e71664
@ -75,7 +75,10 @@ if [ "$(uname)" == 'Darwin' ]; then
|
||||
fi
|
||||
recipe 'git'
|
||||
recipe 'vim-settings'
|
||||
recipe 'golang'
|
||||
if ! is_installed 'golang'; then
|
||||
recipe 'golang'
|
||||
set_installed 'golang'
|
||||
fi
|
||||
recipe 'fish'
|
||||
if $install_ui_terms ; then
|
||||
recipe 'alacritty'
|
||||
|
@ -2,16 +2,25 @@
|
||||
|
||||
# Installs golang from the web
|
||||
|
||||
version="1.19"
|
||||
ARCH=$(uname -m)
|
||||
if [ "$ARCH" = "x86_64" ]; then
|
||||
ARCH=amd64
|
||||
fi
|
||||
|
||||
if [[ "$UNAME_STR" == "Darwin" ]]; then
|
||||
wget -P "$TMP_DIR/" "https://go.dev/dl/go${version}.darwin-$ARCH.pkg"
|
||||
sudo installer -target / -pkg "$TMP_DIR/go${version}.darwin-$ARCH.pkg"
|
||||
elif [[ "$UNAME_STR" == "Linux" ]]; then
|
||||
wget -P "$TMP_DIR/" "https://go.dev/dl/go${version}.linux-$ARCH.tar.gz"
|
||||
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf "$TMP_DIR/go${version}.linux-$ARCH.tar.gz"
|
||||
fi
|
||||
function install_go() {
|
||||
local version="1.20.2"
|
||||
if command -v "go" > /dev/null 2>&1 && go version | grep "$version"; then
|
||||
echo "Go version $version is already installed"
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [[ "$UNAME_STR" == "Darwin" ]]; then
|
||||
wget -P "$TMP_DIR/" "https://go.dev/dl/go${version}.darwin-$ARCH.pkg"
|
||||
sudo installer -target / -pkg "$TMP_DIR/go${version}.darwin-$ARCH.pkg"
|
||||
elif [[ "$UNAME_STR" == "Linux" ]]; then
|
||||
wget -P "$TMP_DIR/" "https://go.dev/dl/go${version}.linux-$ARCH.tar.gz"
|
||||
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf "$TMP_DIR/go${version}.linux-$ARCH.tar.gz"
|
||||
fi
|
||||
}
|
||||
|
||||
install_go
|
||||
|
Loading…
Reference in New Issue
Block a user