From 63e60456438710523e185e02fc39ffc540e1615d Mon Sep 17 00:00:00 2001 From: Michiel Scholten Date: Mon, 14 Sep 2026 14:11:50 +0200 Subject: [PATCH] Reflowed; Added question to install the Fisher plugin manager --- install.sh | 111 ++++++++++++++++++++++++++++++++--------------------- 1 file changed, 67 insertions(+), 44 deletions(-) diff --git a/install.sh b/install.sh index 947effd..8d12763 100644 --- a/install.sh +++ b/install.sh @@ -1,8 +1,7 @@ #!/bin/bash # inspired by rrix' dotfiles -install_fish() -{ +install_fish() { touch ~/.dot/.dot_has_fish mkdir -p "${HOME}/.config/fish/completions" curl -sL get.fisherman.sh | fish @@ -12,50 +11,59 @@ install_fish() ln -s "${HOME}/workspace/application_addons/cli/tmuxinator/completion/mux.fish" "${HOME}/.config/fish/completions" ln -s "${HOME}/workspace/application_addons/cli/tmuxinator/completion/tmuxinator.fish" "${HOME}/.config/fish/completions" echo - echo "You might want to install Fisher:" + echo "Do you wish to install the Fisher plugin manager? This will do:" echo "curl -sL https://git.io/fisher | source && fisher install jorgebucaran/fisher" echo "fisher update" echo + select yn in "Yes" "No"; do + case $yn in + Yes) + curl -sL https://git.io/fisher | source && fisher install jorgebucaran/fisher + fisher update + break + ;; + No) break ;; + esac + done } -make_link() -{ - DIR="$1" - TARGET="$2" - cd || exit - echo $TARGET - if [ "$(readlink $TARGET)" = "$DIR/$TARGET" ]; then - echo " symlink exists and is fine, skipping" - return - elif [ -e $TARGET ] || [ -L $TARGET ] && [ "$(readlink $TARGET)" != "$DIR/$TARGET" ]; then - echo " exists, moving out of the way" - if [ ! -d "workspace/backup/dotfiles_$DATETIME" ]; then - mkdir -p "workspace/backup/dotfiles_$DATETIME" - fi - DIRNAME=$(dirname ${TARGET}) - if [ "$DIRNAME" != "." ]; then - mkdir "workspace/backup/dotfiles_$DATETIME/$DIRNAME" - mv $TARGET "workspace/backup/dotfiles_$DATETIME/$DIRNAME" - #echo "workspace/backup/privdotfiles_$DATETIME/$DIRNAME" - else - mv $TARGET "workspace/backup/dotfiles_$DATETIME/" - #echo "workspace/backup/privdotfiles_$DATETIME/${TARGET}" - fi - fi +make_link() { + DIR="$1" + TARGET="$2" + cd || exit + echo $TARGET + if [ "$(readlink $TARGET)" = "$DIR/$TARGET" ]; then + echo " symlink exists and is fine, skipping" + return + elif [ -e $TARGET ] || [ -L $TARGET ] && [ "$(readlink $TARGET)" != "$DIR/$TARGET" ]; then + echo " exists, moving out of the way" + if [ ! -d "workspace/backup/dotfiles_$DATETIME" ]; then + mkdir -p "workspace/backup/dotfiles_$DATETIME" + fi + DIRNAME=$(dirname ${TARGET}) + if [ "$DIRNAME" != "." ]; then + mkdir "workspace/backup/dotfiles_$DATETIME/$DIRNAME" + mv $TARGET "workspace/backup/dotfiles_$DATETIME/$DIRNAME" + #echo "workspace/backup/privdotfiles_$DATETIME/$DIRNAME" + else + mv $TARGET "workspace/backup/dotfiles_$DATETIME/" + #echo "workspace/backup/privdotfiles_$DATETIME/${TARGET}" + fi + fi - # If link is in a subdir, go there - DIRNAME=$(dirname ${TARGET}) - if [ "$DIRNAME" != "." ]; then - cd "$DIRNAME" || exit - fi - # Create the symlink - ln -s "$DIR/$TARGET" - #echo "ln -s $DIR/$TARGET" + # If link is in a subdir, go there + DIRNAME=$(dirname ${TARGET}) + if [ "$DIRNAME" != "." ]; then + cd "$DIRNAME" || exit + fi + # Create the symlink + ln -s "$DIR/$TARGET" + #echo "ln -s $DIR/$TARGET" } # Get the directory the dotfiles have been cloned into -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" echo "Installing from $DIR" DATETIME=$(date +%Y%m%d_%H%M) @@ -66,8 +74,7 @@ cd || exit mkdir -p .config/direnv # Symlink all the things -for TARGET in .bash_aliases .bashrc bin .gitconfig .gitignore_global .gitmodules .hgauthors.txt .hgignore .hgrc .ideavimrc .ignore .screenrc .terminfo .tmux.conf .vim .vimrc install.sh .config/direnv/direnvrc .config/nvim -do +for TARGET in .bash_aliases .bashrc bin .gitconfig .gitignore_global .gitmodules .hgauthors.txt .hgignore .hgrc .ideavimrc .ignore .screenrc .terminfo .tmux.conf .vim .vimrc install.sh .config/direnv/direnvrc .config/nvim; do make_link $DIR $TARGET done @@ -89,8 +96,14 @@ elif [ ! -e ~/.dot/.dot_no_fish ]; then echo "Do you wish to install fish shell configuration?" select yn in "Yes" "No"; do case $yn in - Yes ) install_fish; break;; - No ) touch ~/.dot/.dot_no_fish; break;; + Yes) + install_fish + break + ;; + No) + touch ~/.dot/.dot_no_fish + break + ;; esac done fi @@ -99,8 +112,12 @@ echo echo "Do you wish to install the starship prompt?" select yn in "Yes" "No"; do case $yn in - Yes ) make_link $DIR ".config/starship.toml"; curl -sS https://starship.rs/install.sh | sh; break;; - No ) break;; + Yes) + make_link $DIR ".config/starship.toml" + curl -sS https://starship.rs/install.sh | sh + break + ;; + No) break ;; esac done @@ -109,8 +126,14 @@ if [ ! -e ~/.dot_is_server ] && [ ! -e ~/.dot_no_server ]; then echo "Is this machine a server?" select yn in "Yes" "No"; do case $yn in - Yes ) touch ~/.dot_is_server; break;; - No ) touch ~/.dot_no_server; break;; + Yes) + touch ~/.dot_is_server + break + ;; + No) + touch ~/.dot_no_server + break + ;; esac done fi