Last active
March 25, 2024 08:05
-
-
Save nextify2025/874662fb204d32390bc2f2e9e4d2df0a to your computer and use it in GitHub Desktop.
Revisions
-
nextify renamed this gist
Mar 25, 2024 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
nextify created this gist
Mar 25, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,86 @@ #!/bin/bash # Function to check if git is installed check_git_installed() { if ! command -v git > /dev/null; then echo "git is not installed. Attempting to install..." if command -v apt > /dev/null; then sudo apt update && sudo apt install -y git elif command -v dnf > /dev/null; then sudo dnf makecache && sudo dnf install -y git elif command -v yum > /dev/null; then sudo yum makecache && sudo yum install -y git else echo "Unsupported package manager. Please install git manually." exit 1 fi fi } # Function to install unzip and bun install_unzip_and_bun() { if command -v apt > /dev/null; then sudo apt update && sudo apt install -y unzip elif command -v dnf > /dev/null; then sudo dnf makecache && sudo dnf install -y unzip elif command -v yum > /dev/null; then sudo yum makecache && sudo yum install -y unzip else echo "Unsupported package manager. Please install unzip manually." exit 1 fi # Install bun curl -fsSL https://bun.sh/install | bash # Add bun to PATH in .bashrc and current session echo 'export BUN_INSTALL="$HOME/.bun"' >> ~/.bashrc echo 'export PATH="$BUN_INSTALL/bin:$PATH"' >> ~/.bashrc export BUN_INSTALL="$HOME/.bun" export PATH="$BUN_INSTALL/bin:$PATH" } # Function to install nvm and Node.js install_nvm_and_node() { # Install nvm curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash # Load nvm export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # Install Node.js using nvm nvm install 20 } # Check for curl and bash if ! command -v curl > /dev/null || ! command -v bash > /dev/null; then echo "This script requires curl and bash. Please install them and try again." exit 1 fi # Check and install git if necessary check_git_installed # Execute installation functions install_unzip_and_bun install_nvm_and_node case "$SHELL" in */zsh) if [ -f ~/.zshrc ]; then . ~/.zshrc fi ;; */bash) if [ -f ~/.bashrc ]; then . ~/.bashrc fi ;; *) echo "Unsupported shell: $SHELL" ;; esac echo "Installation complete."