This commit is contained in:
2024-12-25 08:54:27 +01:00
parent 4a50de92e3
commit 01ca5897db
3 changed files with 82 additions and 11 deletions

View File

@@ -1,2 +1,39 @@
# herolib # herolib
a smaller version of crystallib with only the items we need for hero a smaller version of crystallib with only the items we need for hero
## automated install
```bash
```
## to install v
```bash
#~/code/github/freeflowuniverse/herolib/install_v.sh --help
V & HeroLib Installer Script
Usage: /Users/despiegk1/code/github/freeflowuniverse/herolib/install_v.sh [options]
Options:
-h, --help Show this help message
--reset Force reinstallation of V
--remove Remove V installation and exit
--analyzer Install/update v-analyzer
--herolib Install our herolib
Examples:
/Users/despiegk1/code/github/freeflowuniverse/herolib/install_v.sh
/Users/despiegk1/code/github/freeflowuniverse/herolib/install_v.sh --reset
/Users/despiegk1/code/github/freeflowuniverse/herolib/install_v.sh --remove
/Users/despiegk1/code/github/freeflowuniverse/herolib/install_v.sh --analyzer
/Users/despiegk1/code/github/freeflowuniverse/herolib/install_v.sh --herolib
/Users/despiegk1/code/github/freeflowuniverse/herolib/install_v.sh --reset --analyzer # Fresh install of both
```

View File

@@ -9,8 +9,8 @@ abs_dir_of_script := dir(@FILE)
// Reset symlinks if requested // Reset symlinks if requested
println('Resetting all symlinks...') println('Resetting all symlinks...')
os.rmdir_all('${os.home_dir()}/.vmodules/freeflowuniverse/herolib') or {} os.rmdir_all('${os.home_dir()}/.vmodules/freeflowuniverse/herolib') or {}
os.rm('${os.home_dir()}/.vmodules/freeflowuniverse/herolib') or {}
os.rmdir_all('${os.home_dir()}/.vmodules/vlang/testing') or {} os.rmdir_all('${os.home_dir()}/.vmodules/vlang/testing') or {}
os.rm('/usr/local/bin/herolib') or {}
// Create necessary directories // Create necessary directories
os.mkdir_all('${os.home_dir()}/.vmodules/freeflowuniverse') or { os.mkdir_all('${os.home_dir()}/.vmodules/freeflowuniverse') or {

View File

@@ -1,5 +1,5 @@
#!/bin/bash -ex #!/bin/bash -e
# Help function # Help function
print_help() { print_help() {
@@ -106,6 +106,38 @@ function package_install {
} }
function myplatform {
if [[ "${OSTYPE}" == "darwin"* ]]; then
export OSNAME='darwin'
elif [ -e /etc/os-release ]; then
# Read the ID field from the /etc/os-release file
export OSNAME=$(grep '^ID=' /etc/os-release | cut -d= -f2)
if [ "${os_id,,}" == "ubuntu" ]; then
export OSNAME="ubuntu"
fi
if [ "${OSNAME}" == "archarm" ]; then
export OSNAME="arch"
fi
if [ "${OSNAME}" == "debian" ]; then
export OSNAME="ubuntu"
fi
else
echo "Unable to determine the operating system."
exit 1
fi
# if [ "$(uname -m)" == "x86_64" ]; then
# echo "This system is running a 64-bit processor."
# else
# echo "This system is not running a 64-bit processor."
# exit 1
# fi
}
myplatform
function os_update { function os_update {
echo ' - os update' echo ' - os update'
if [[ "${OSNAME}" == "ubuntu" ]]; then if [[ "${OSNAME}" == "ubuntu" ]]; then
@@ -136,7 +168,7 @@ function os_update {
elif [[ "${OSNAME}" == "darwin"* ]]; then elif [[ "${OSNAME}" == "darwin"* ]]; then
if command -v brew >/dev/null 2>&1; then if command -v brew >/dev/null 2>&1; then
echo 'homebrew installed' echo ' - homebrew installed'
else else
export NONINTERACTIVE=1 export NONINTERACTIVE=1
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
@@ -165,7 +197,7 @@ function os_update {
execute_with_marker "paru_install" paru_install execute_with_marker "paru_install" paru_install
fi fi
fi fi
echo 'os_update done' echo ' - os update done'
} }
@@ -245,13 +277,14 @@ fi
# Create code directory if it doesn't exist # Create code directory if it doesn't exist
mkdir -p ~/code mkdir -p ~/code
os_update
sshknownkeysadd
# Check if v needs to be installed # Check if v needs to be installed
if [ "$RESET" = true ] || ! command_exists v; then if [ "$RESET" = true ] || ! command_exists v; then
os_update
sshknownkeysadd
# Only clone and install if directory doesn't exist # Only clone and install if directory doesn't exist
if [ ! -d ~/code/v ]; then if [ ! -d ~/code/v ]; then
echo "Installing V..." echo "Installing V..."
@@ -320,12 +353,13 @@ fi
if [ "$HEROLIB" = true ]; then if [ "$HEROLIB" = true ]; then
hero_lib_get hero_lib_get
~/code/github/freeflowuniverse/herolib/install_herolib.vsh
fi fi
if [ "$INSTALL_ANALYZER" = true ]; then # if [ "$INSTALL_ANALYZER" = true ]; then
echo "Run 'source ~/.bashrc' or 'source ~/.zshrc' to update PATH for v-analyzer" # echo "Run 'source ~/.bashrc' or 'source ~/.zshrc' to update PATH for v-analyzer"
fi # fi
echo "Installation complete!" echo "Installation complete!"