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 --- homebrew/install.sh | 3 ++- install.sh | 41 +++-------------------------------------- 2 files changed, 5 insertions(+), 39 deletions(-) diff --git a/homebrew/install.sh b/homebrew/install.sh index f1ca7f9..a211828 100755 --- a/homebrew/install.sh +++ b/homebrew/install.sh @@ -1,4 +1,5 @@ -#!/bin/sh +#!/usr/bin/env bash +set -euo pipefail echo "Installing Brewfile.." brew bundle install --file=./Brewfile 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