aboutsummaryrefslogtreecommitdiffstats
path: root/install.sh
diff options
context:
space:
mode:
authorEugene Triguba <eugenetriguba@gmail.com>2025-06-28 00:56:42 -0400
committerEugene Triguba <eugenetriguba@gmail.com>2025-06-28 00:56:42 -0400
commit39e5ebdc58a941579c0e93751e6e529fe3c41acd (patch)
treea1c8127b77577b1939b83a42bed282342b8d6df0 /install.sh
parentAdd compinit and break out prompt sh script (diff)
downloaddotfiles-39e5ebdc58a941579c0e93751e6e529fe3c41acd.zip
Remove ensure symlink exists
Diffstat (limited to 'install.sh')
-rwxr-xr-xinstall.sh41
1 files changed, 3 insertions, 38 deletions
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