MacOS
This commit is contained in:
@@ -13,13 +13,14 @@ NC='\033[0m'
|
||||
export GVM_ROOT="$HOME/.programming/go"
|
||||
BOOTSTRAP_GO="$GVM_ROOT/bootstrap"
|
||||
|
||||
OS_NAME="$(uname -s)"
|
||||
ARCH="$(uname -m)"
|
||||
|
||||
case "$ARCH" in
|
||||
x86_64)
|
||||
GO_BOOTSTRAP_ARCH="amd64"
|
||||
;;
|
||||
aarch64)
|
||||
aarch64|arm64)
|
||||
GO_BOOTSTRAP_ARCH="arm64"
|
||||
;;
|
||||
*)
|
||||
@@ -28,6 +29,19 @@ case "$ARCH" in
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$OS_NAME" in
|
||||
Linux)
|
||||
GO_BOOTSTRAP_OS="linux"
|
||||
;;
|
||||
Darwin)
|
||||
GO_BOOTSTRAP_OS="darwin"
|
||||
;;
|
||||
*)
|
||||
echo -e "${RED} ERROR:${NC} Unsupported operating system for Go bootstrap: $OS_NAME"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
echo -e "${BLUE} LOG:${YELLOW} Setting up Go and GVM in ${GVM_ROOT}...${NC}"
|
||||
|
||||
if [ ! -d "$GVM_ROOT/scripts" ]; then
|
||||
@@ -36,7 +50,15 @@ if [ ! -d "$GVM_ROOT/scripts" ]; then
|
||||
rm -rf "$GVM_ROOT/.git"
|
||||
echo -e "${BLUE} LOG:${YELLOW} Configuring GVM scripts...${NC}"
|
||||
cp "$GVM_ROOT/scripts/gvm-default" "$GVM_ROOT/scripts/gvm"
|
||||
sed -i "s|^GVM_ROOT=.*|GVM_ROOT=\"$GVM_ROOT\"|" "$GVM_ROOT/scripts/gvm"
|
||||
python3 - "$GVM_ROOT/scripts/gvm" "$GVM_ROOT" <<'PY'
|
||||
from pathlib import Path
|
||||
import sys
|
||||
|
||||
path = Path(sys.argv[1])
|
||||
root = sys.argv[2]
|
||||
text = path.read_text()
|
||||
path.write_text(text.replace('GVM_ROOT="$HOME/.gvm"', f'GVM_ROOT="{root}"', 1))
|
||||
PY
|
||||
|
||||
echo -e "${GREEN} SUCCESS:${NC} GVM cloned and configured."
|
||||
else
|
||||
@@ -47,7 +69,7 @@ if [ ! -d "$BOOTSTRAP_GO" ]; then
|
||||
echo -e "${BLUE} LOG:${YELLOW} Downloading Bootstrap Go...${NC}"
|
||||
mkdir -p "$BOOTSTRAP_GO"
|
||||
|
||||
wget -q "https://go.dev/dl/go1.20.5.linux-${GO_BOOTSTRAP_ARCH}.tar.gz" -O /tmp/go-bootstrap.tar.gz
|
||||
wget -q "https://go.dev/dl/go1.20.5.${GO_BOOTSTRAP_OS}-${GO_BOOTSTRAP_ARCH}.tar.gz" -O /tmp/go-bootstrap.tar.gz
|
||||
tar -C "$BOOTSTRAP_GO" -xzf /tmp/go-bootstrap.tar.gz --strip-components=1
|
||||
rm /tmp/go-bootstrap.tar.gz
|
||||
|
||||
|
||||
Reference in New Issue
Block a user