You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
491 B

#!/bin/bash
if [ "$EUID" -ne 0 ]; then
echo "please run as root!"
exit 1
fi
if [ -z "$1" ]; then
echo "specify a go version to update to"
exit 1
fi
echo "Downloading new Go version..."
wget -P /home/marcy/ "https://go.dev/dl/go$1.linux-amd64.tar.gz"
echo "Removing current Go installation..."
rm -rf /usr/local/go
echo "Installing new Go version..."
tar -C /usr/local -xzf "/home/marcy/go$1.linux-amd64.tar.gz"
echo "Cleaning up..."
rm "/home/marcy/go$1.linux-amd64.tar.gz"
echo "Done!"