#!/usr/bin/env bash set -e echo Installing bbup... BB_HOME=${BB_HOME-"$HOME/.bb"} BBUP_BIN_URL=${BBUP_BIN_URL-"https://raw.githubusercontent.com/AztecProtocol/aztec-packages/master/barretenberg/cpp/installation/bbup"} BBUP_BIN_PATH="$BB_HOME/bbup" # Create the .bb directory and bbup binary if it doesn't exist. mkdir -p $BB_HOME curl -# -L $BBUP_BIN_URL -o $BBUP_BIN_PATH chmod +x $BBUP_BIN_PATH # Store the correct profile file (i.e. .profile for bash or .zshrc for ZSH). case $SHELL in */zsh) PROFILE=$HOME/.zshrc PREF_SHELL=zsh ;; */bash) PROFILE=$HOME/.bashrc PREF_SHELL=bash ;; */fish) PROFILE=$HOME/.config/fish/config.fish PREF_SHELL=fish ;; */ash) PROFILE=$HOME/.profile PREF_SHELL=ash ;; *) echo "bbup: could not detect shell, manually add ${BB_HOME} to your PATH." exit 1 ;; esac # Only add bbup if it isn't already in PATH. if [[ ":$PATH:" != *":${BB_HOME}:"* ]]; then # Add the .bb directory to the path and ensure the old PATH variables remain. echo >>$PROFILE && echo "export BB_HOME=\"$BB_HOME\"" >>$PROFILE echo >>$PROFILE && echo "export PATH=\"\$PATH:\$BB_HOME\"" >>$PROFILE fi echo && echo "Detected your preferred shell is ${PREF_SHELL} and added bbup to PATH. Run 'source ${PROFILE}' or start a new terminal session to use bbup." echo "Then, simply run 'bbup' to install bb."