From 2a4aa282b7281cfe2f2499b57cc82cda6cf8c2e8 Mon Sep 17 00:00:00 2001 From: Eugene Triguba Date: Sun, 15 Jun 2025 14:28:22 -0400 Subject: remove gdb config and tweak shell config --- install.sh | 1 - 1 file changed, 1 deletion(-) (limited to 'install.sh') diff --git a/install.sh b/install.sh index c6c8a00..48a23c4 100755 --- a/install.sh +++ b/install.sh @@ -95,7 +95,6 @@ main() { stow nvim stow zsh stow git - stow gdb stow gpg stow tmux stow ghostty -- cgit v1.2.3 From 39e5ebdc58a941579c0e93751e6e529fe3c41acd Mon Sep 17 00:00:00 2001 From: Eugene Triguba Date: Sat, 28 Jun 2025 00:56:42 -0400 Subject: Remove ensure symlink exists --- install.sh | 41 +++-------------------------------------- 1 file changed, 3 insertions(+), 38 deletions(-) (limited to 'install.sh') diff --git a/install.sh b/install.sh index 48a23c4..f162211 100755 --- a/install.sh +++ b/install.sh @@ -1,4 +1,6 @@ -#!/bin/sh +#!/usr/bin/env bash +set -eou pipefail + # # Install the Homebrew Brewfile and setup symbolic links to the # dotfiles. @@ -37,43 +39,6 @@ prompt_for_confirmation() { fi } -ensure_symlink_exists() { - source_path="$1" - link_path="$2" - - echo "Checking link to '$link_path'.." - if [ -L "$link_path" ]; then - if [ -e "$link_path" ]; then - echo "Valid '$link_path' link exists." - else - echo "'$link_path' link exists, but it is a broken link." - prompt_for_confirmation "Delete and relink?" - answer=$? - if [ $answer -eq 0 ]; then - rm -r "$link_path" || exit 1 - ln -s "$source_path" "$link_path" || exit 1 - echo "Successfully created link to '$link_path'" - else - echo "Leaving file alone, moving on.." - fi - fi - elif [ -e "$link_path" ]; then - echo "'$link_path' exists, but it isn't a symbolic link file." - prompt_for_confirmation "Delete and relink?" - answer=$? - if [ $answer -eq 0 ]; then - rm -r "$link_path" || exit 1 - ln -s "$source_path" "$link_path" || exit 1 - echo "Successfully created link to '$link_path'" - else - echo "Leaving file alone, moving on.." - fi - else - echo "Link to '$link_path' does not exist. Creating.." - ln -s "$source_path" "$link_path" || exit 1 - fi -} - main() { has_homebrew=$(command -v brew) if test -z "$has_homebrew"; then -- cgit v1.2.3 From de8d636d36ec4e699ca739e0ef0874aa0b3297f1 Mon Sep 17 00:00:00 2001 From: Eugene Triguba Date: Sat, 28 Jun 2025 09:19:30 -0400 Subject: Tidy up install script --- install.sh | 75 ++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 36 insertions(+), 39 deletions(-) (limited to 'install.sh') diff --git a/install.sh b/install.sh index f162211..cec3281 100755 --- a/install.sh +++ b/install.sh @@ -1,24 +1,31 @@ #!/usr/bin/env bash -set -eou pipefail - # # Install the Homebrew Brewfile and setup symbolic links to the # dotfiles. -# - -# Installs homebrew and verifies the installation. -# If the install was not successful, exits with a -# 1 status code. -install_homebrew() { - /usr/bin/env bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" - echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >>"$HOME/.zprofile" - eval "$(/opt/homebrew/bin/brew shellenv)" +set -eou pipefail - homebrew_exists=$(command -v brew) - if test -z "$homebrew_exists"; then - echo "Failed to install homebrew" - exit 1 +main() { + if ! command -v brew >/dev/null 2>&1; then + if prompt_for_confirmation "Homebrew not found. Would you like to install Homebrew?"; then + install_homebrew + else + echo "Exiting, can't continue without Homebrew installed." + exit 0 + fi fi + + echo "Found homebrew installation. Installing Brewfile.." + (cd homebrew && brew bundle) + echo "Brewfile successfully installed. Moving to linking dotfiles.." + + stow executables + stow nvim + stow zsh + stow git + stow gpg + stow tmux + stow ghostty + echo "Successfully linked all dotfiles." } # Prompt the user for confirmation on an action. @@ -32,38 +39,28 @@ install_homebrew() { prompt_for_confirmation() { printf "%s [y/n]: " "$1" read -r answer - if [ "$answer" != "${answer#[Yy]}" ]; then + if [[ "$answer" != "${answer#[Yy]}" ]]; then return 0 else return 1 fi } -main() { - has_homebrew=$(command -v brew) - if test -z "$has_homebrew"; then - prompt_for_confirmation "I couldn't find a homebrew installation. Would you like to install homebrew?" - answer=$? - if [ $answer -eq 0 ]; then - install_homebrew - else - echo "Exiting, can't continue without homebrew installed." - exit 0 - fi - fi +# Installs homebrew and verifies the installation. +# +# If the install was not successful, exits with a +# 1 status code. +install_homebrew() { + /usr/bin/env bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" - echo "Found homebrew installation. Installing Brewfile.." - (cd homebrew && brew bundle || exit 1) - echo "Brewfile successfully installed. Moving to linking dotfiles.." + # shellcheck disable=SC2016 + echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >>"$HOME/.zprofile" + eval "$(/opt/homebrew/bin/brew shellenv)" - stow executables - stow nvim - stow zsh - stow git - stow gpg - stow tmux - stow ghostty - echo "Successfully linked all dotfiles." + if ! command -v brew >/dev/null 2>&1; then + echo "Failed to install homebrew" + exit 1 + fi } main -- cgit v1.2.3