diff --git a/files/home/.aliases b/files/home/.aliases index f3d57e7..af95c91 100644 --- a/files/home/.aliases +++ b/files/home/.aliases @@ -1,5 +1,5 @@ alias bench='ZSH_BENCH=1 exec zsh' -alias dots='$DOTFILES/install' +alias dots='cd $DOTFILES' alias j='z' alias reload='source ~/.zshrc' alias zen='curl -s https://api.github.com/zen && echo' diff --git a/files/home/.profile b/files/home/.profile index b08d49b..a9dd2ec 100644 --- a/files/home/.profile +++ b/files/home/.profile @@ -34,21 +34,6 @@ _dots_load_nvm() { } _dots_load_nvm -_dots_install_node() { - node_alias="$NVM_DIR/alias/lts/jod" - if [ -f "$node_alias" ]; then - VERSION=`cat $node_alias` - if [ -x `command -v nvm` ]; then - nvm install "$VERSION" > /dev/null 2>&1 & disown - fi - node_bin_path="$NVM_DIR/versions/node/$VERSION/bin" - if [[ ":$PATH:" != *":$node_bin_path:"* ]]; then - export PATH="$node_bin_path:$PATH" - fi - fi -} -_dots_install_node - # Initialise and load pyenv # ----------------------------------------------------------------- export PYENV_ROOT=${PYENV_ROOT:-"$HOME/.pyenv"} diff --git a/script/install b/script/install index 1a66cd6..cf17eb1 100755 --- a/script/install +++ b/script/install @@ -6,6 +6,8 @@ set -eo pipefail # if [[ -t 1 && -n "$TERM" && "$TERM" != "dumb" ]]; then + CYAN="\033[0;36m" + CYAN_BOLD="\033[1;36m" RED="\033[1;31m" GREEN="\033[1;32m" YELLOW="\033[1;33m" @@ -19,7 +21,7 @@ else NC="" fi -printf "\n\t${GREEN} <<< dots >>> ${NC}\n" +printf "\n\t${CYAN} <<< ${CYAN_BOLD}dots${CYAN} >>> ${NC}\n" printf "\t${GREY}==============${NC}\n\n" # Prevent running as root @@ -30,7 +32,7 @@ fi # Ensure sudo credentials are cached if [[ -z "$SKIP_SUDO_CHECK" ]]; then - echo -e "${GREY}Checking sudo credentials...${NC}" + echo -e "${YELLOW}Checking sudo credentials...${NC}" sudo -v fi @@ -69,12 +71,12 @@ targets=($@) # Run install scripts run() { - echo -e "${GREY}Running \"$(basename "$0")\" at \"$(date)\"${NC}" - echo -e "${GREY}Running as \"$(whoami)\" on \"$(hostname)\"${NC}" + echo -e "Running \"$(basename "$0")\" at \"$(date)\"" + echo -e "Running as \"$(whoami)\" on \"$(hostname)\"" if [[ -n "$targets" ]]; then - echo -e "${GREY}Running ${#targets[@]} install target(s): ${targets[@]}${NC}" + echo -e "Running ${YELLOW}${#targets[@]}${NC} install target(s): ${YELLOW}${targets[@]}${NC}" else - echo -e "${GREY}Running all install targets${NC}" + echo -e "Running all install targets" fi for script in $install_dir/*.sh; do @@ -88,7 +90,7 @@ run() { local script_name=$(basename $script) - printf "\n\n${GREY}<<< $script_name:${NC}\n" + printf "\n\n${CYAN}<<< ${CYAN_BOLD}$script_name:${NC}\n" local start_time=$(date +%s.%N) source $script local end_time=$(date +%s.%N) @@ -96,19 +98,23 @@ run() { local execution_ms=$(echo "$execution_time * 1000" | bc | awk '{printf "%.0f", $0}') local execution_ms_formatted=$(printf "%'.0f" "$execution_ms") local time_color="$GREY" - if (( execution_ms > 1000 )); then + if (( execution_ms < 2000 )); then + time_color="$GREEN" + elif (( execution_ms < 5000 )); then + time_color="$YELLOW" + else time_color="$RED" fi - printf "\n${GREY}>>> $script_name, " + printf "\n${CYAN}>>> ${CYAN_BOLD}${script_name}, ${NC}" printf "completed in ${time_color}${execution_ms_formatted}ms${NC}\n" done } -echo -e "\n${GREY}install: Logging to \"$log_abs_target\"${NC}" +echo -e "\ninstall: Logging to \"$log_abs_target\"" start_time=$(date +%s.%N) run 2>&1 | tee "$log_abs_target" end_time=$(date +%s.%N) total_time_raw=$(echo "$end_time - $start_time" | bc) total_time=$(echo "$total_time_raw" | awk '{printf "%.3g", $1}') -echo -e "\n${GREY}Thank you!${NC}" -echo -e "${GREY}Total time: ${GREEN}${total_time}s${NC}\n" +echo -e "\nThank you!" +echo -e "Total time: ${GREEN}${total_time}s${NC}\n" diff --git a/script/install.d/01-ssh.sh b/script/install.d/01-ssh.sh index cd22b7e..4c3c6c0 100644 --- a/script/install.d/01-ssh.sh +++ b/script/install.d/01-ssh.sh @@ -7,7 +7,7 @@ # skip if CODESPACES is set if [ -n "$CODESPACES" ]; then - echo -e "${GREY}Running in a GitHub Codespace${NC}" + echo -e "${YELLOW}Running in a GitHub Codespace${NC}" export SKIP_SSH_CONFIG=1 fi diff --git a/script/install.d/10-pyenv.sh b/script/install.d/10-pyenv.sh index b5a3760..e26e7b7 100644 --- a/script/install.d/10-pyenv.sh +++ b/script/install.d/10-pyenv.sh @@ -9,7 +9,7 @@ export PYENV_ROOT="$HOME/.pyenv" if ! echo $PATH | grep -q "$PYENV_ROOT"; then export PATH="$PYENV_ROOT/bin:$PATH" fi -if ! command -v "pyenv" &>/dev/null; then +if ! command -v pyenv &>/dev/null; then if [[ "$OSTYPE" == "linux-gnu"* ]]; then # https://github.com/pyenv/pyenv/wiki#suggested-build-environment sudo apt-get install -qq build-essential libssl-dev zlib1g-dev \ diff --git a/script/install.d/11-python.sh b/script/install.d/11-python.sh index d82166a..1937c1c 100644 --- a/script/install.d/11-python.sh +++ b/script/install.d/11-python.sh @@ -7,7 +7,7 @@ export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring -if ! command -v "python" &>/dev/null; then +if ! command -v python &>/dev/null; then pyenv install 3.12.1 pyenv global 3.12.1 fi @@ -38,7 +38,7 @@ fi mkdir -p ~/.local/bin unset local_bin_path -if ! command -v "pipx" &>/dev/null; then +if ! command -v pipx &>/dev/null; then if [[ "$OSTYPE" == "linux-gnu"* ]]; then sudo apt-get install -qq pipx elif [[ "$OSTYPE" == "darwin"* ]]; then @@ -48,7 +48,7 @@ fi echo "pipx $(pipx --version)" -if ! command -v "poetry" &>/dev/null; then +if ! command -v poetry &>/dev/null; then pipx install poetry fi diff --git a/script/install.d/12-node.sh b/script/install.d/12-node.sh index 2a3a96d..0aedaf9 100644 --- a/script/install.d/12-node.sh +++ b/script/install.d/12-node.sh @@ -8,8 +8,8 @@ NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" [ -s "$NVM_DIR/nvm.sh" ] && source "$NVM_DIR/nvm.sh" -nvm_version="0.39.7" -if ! command -v "nvm" &>/dev/null; then +nvm_version="0.40.3" +if ! command -v nvm &>/dev/null; then bash -c "$(curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v${nvm_version}/install.sh)" [ -s "$NVM_DIR/nvm.sh" ] && source "$NVM_DIR/nvm.sh" fi @@ -25,9 +25,9 @@ echo "npm $(npm --version)" npm_dependencies=( "firebase-tools" - "neovim" - "typescript-language-server" - "typescript" + # "neovim" + # "typescript-language-server" + # "typescript" ) npm_dependencies=($(comm -13 <(printf "%s\n" "${npm_dependencies[@]}" | sort) <(npm list -g --depth=0 --parseable | awk -F'/' '{print $NF}' | sort))) diff --git a/script/install.d/20-docker.sh b/script/install.d/20-docker.sh index 28bd16c..dd8d085 100644 --- a/script/install.d/20-docker.sh +++ b/script/install.d/20-docker.sh @@ -8,19 +8,19 @@ # skip if in WSL if [[ -n "$WSL_DISTRO_NAME" ]]; then - echo -e "${GREY}Running in WSL${NC}" + echo -e "${YELLOW}Running in WSL${NC}" export SKIP_DOCKER_CONFIG=1 fi # skip if in CODESPACES if [[ -n "$CODESPACES" ]]; then - echo -e "${GREY}Running in GitHub Codespaces${NC}" + echo -e "${YELLOW}Running in GitHub Codespaces${NC}" export SKIP_DOCKER_CONFIG=1 fi # skip on mac if [[ "$OSTYPE" == "darwin"* ]]; then - echo -e "${GREY}Running on macOS${NC}" + echo -e "${YELLOW}Running on macOS${NC}" export SKIP_DOCKER_CONFIG=1 fi diff --git a/script/install.d/25-terraform.sh b/script/install.d/25-terraform.sh index b3771bc..32797dd 100644 --- a/script/install.d/25-terraform.sh +++ b/script/install.d/25-terraform.sh @@ -5,7 +5,7 @@ # Install terraform. # -if ! command -v "terraform" &>/dev/null; then +if ! command -v terraform &>/dev/null; then if [[ "$OSTYPE" == "linux-gnu"* ]]; then terraform_keyring_path="/usr/share/keyrings/hashicorp-archive-keyring.gpg" if [[ ! -f "$terraform_keyring_path" ]]; then diff --git a/script/install.d/80-neofetch.sh b/script/install.d/80-neofetch.sh index c6beaa1..499170c 100644 --- a/script/install.d/80-neofetch.sh +++ b/script/install.d/80-neofetch.sh @@ -5,7 +5,7 @@ # Install neofetch. # -if ! command -v "neofetch" &>/dev/null; then +if ! command -v neofetch &>/dev/null; then if [[ "$OSTYPE" == "linux-gnu"* ]]; then sudo apt-get install -qq neofetch &>/dev/null elif [[ "$OSTYPE" == "darwin"* ]]; then diff --git a/script/install.d/81-cmatrix.sh b/script/install.d/81-cmatrix.sh index 5da841f..51dd379 100644 --- a/script/install.d/81-cmatrix.sh +++ b/script/install.d/81-cmatrix.sh @@ -7,7 +7,7 @@ # skip if in CODESPACES if [[ -n "$CODESPACES" ]]; then - echo -e "${GREY}Running in GitHub Codespaces${NC}" + echo -e "${YELLOW}Running in GitHub Codespaces${NC}" export SKIP_CMATRIX_CONFIG=1 fi