feat: add shell of startup install mage.
This commit is contained in:
parent
a454b4f5cb
commit
1389c44bb9
31
bootstrap_install_mage.bat
Normal file
31
bootstrap_install_mage.bat
Normal file
@ -0,0 +1,31 @@
|
||||
@echo off
|
||||
SETLOCAL
|
||||
|
||||
mage -version >nul 2>&1
|
||||
IF %ERRORLEVEL% EQU 0 (
|
||||
echo Mage is already installed.
|
||||
GOTO DOWNLOAD
|
||||
)
|
||||
|
||||
go version >nul 2>&1
|
||||
IF NOT %ERRORLEVEL% EQU 0 (
|
||||
echo Go is not installed. Please install Go and try again.
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo Installing Mage...
|
||||
go install github.com/magefile/mage@latest
|
||||
|
||||
mage -version >nul 2>&1
|
||||
IF NOT %ERRORLEVEL% EQU 0 (
|
||||
echo Mage installation failed.
|
||||
echo Please ensure that %GOPATH%/bin is in your PATH.
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo Mage installed successfully.
|
||||
|
||||
:DOWNLOAD
|
||||
go mod download
|
||||
|
||||
ENDLOCAL
|
23
bootstrap_install_mage.sh
Normal file
23
bootstrap_install_mage.sh
Normal file
@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [[ ":$PATH:" == *":$HOME/.local/bin:"* ]]; then
|
||||
TARGET_DIR="$HOME/.local/bin"
|
||||
else
|
||||
TARGET_DIR="/usr/local/bin"
|
||||
echo "Using /usr/local/bin as the installation directory. Might require sudo permissions."
|
||||
fi
|
||||
|
||||
if ! command -v mage &> /dev/null; then
|
||||
echo "Installing Mage to $TARGET_DIR ..."
|
||||
GOBIN=$TARGET_DIR go install github.com/magefile/mage@latest
|
||||
fi
|
||||
|
||||
if ! command -v mage &> /dev/null; then
|
||||
echo "Mage installation failed."
|
||||
echo "Please ensure that $TARGET_DIR is in your \$PATH."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Mage installed successfully."
|
||||
|
||||
go mod download
|
Loading…
x
Reference in New Issue
Block a user