commit b68898fa65f064e6befd0cb23067287df65de12b parent a00b35a806be0b6c8d963d93a45a502a2b3d7e78 Author: Jake Koroman <jake@jakekoroman.com> Date: Sat, 8 Nov 2025 00:55:49 -0500 update deploy script Diffstat:
| M | MANIFEST | | | 30 | +++++++++++++++--------------- |
| M | deploy.sh | | | 47 | ++++++++++++++++++++++++++--------------------- |
2 files changed, 41 insertions(+), 36 deletions(-)
diff --git a/MANIFEST b/MANIFEST @@ -1,15 +1,15 @@ -.Xresources|symlink| -emacs|symlink|.config/ -i3|symlink|.config/ -i3status|symlink|.config/ -scripts|symlink| -sxhkd|symlink|.config/ -gtk-3.0|symlink|.config/ -isyncrc|symlink|.config/ -.gitconfig|symlink| -tmux|symlink|.config/ -.bashrc|symlink| -.bash_profile|symlink| -msmtp|symlink|.config/ -nvim|symlink|.config/ -picom|symlink|.config/ +.Xresources| +emacs|.config +i3|.config +i3status|.config +scripts| +sxhkd|.config +gtk-3.0|.config +isyncrc|.config +.gitconfig| +tmux|.config +.bashrc| +.bash_profile| +msmtp|.config +nvim|.config +picom|.config diff --git a/deploy.sh b/deploy.sh @@ -3,42 +3,47 @@ # forked from: https://github.com/rexim/dotfiles/blob/master/deploy.sh SCRIPT_DIR="$( cd "$( dirname "$BASH_SOURCE[0]" )" && pwd )" +MANIFEST_FILE="MANIFEST" symlink_file() { filename="$SCRIPT_DIR/$1" - destination="$HOME/$2/$1" + destination=$(echo "$HOME/$2/$1" | sed 's/\/\//\//g') mkdir -p $(dirname "$destination") - if [ ! -L "$destination" ]; then + if [ -L "$destination" ]; then + echo "info: updating $filename symlink" + rm -f "$destination" > /dev/null + ln -s "$filename" "$destination" + else if [ -e "$destination" ]; then - echo "[ERROR] $destination exists but it's not a symlink. Please fix that manually" && exit 1 + echo "error: $destination exists but it's not a symlink. Please fix that manually" && return else ln -s "$filename" "$destination" - echo "[OK] $filename -> $destination" + echo "info: $filename -> $destination" fi - else - echo "[WARNING] $filename already symlinked" fi } deploy_manifest() { - for row in $(cat $SCRIPT_DIR/$1); do + echo "--- deploying ---" + for row in $(cat "$SCRIPT_DIR/$MANIFEST_FILE"); do + filename=$(echo $row | cut -d \| -f 1) + destination=$(echo $row | cut -d \| -f 2) + symlink_file $filename $destination + done +} + +clean() { + echo "--- cleaning up ---" + for row in $(cat "$SCRIPT_DIR/$MANIFEST_FILE"); do filename=$(echo $row | cut -d \| -f 1) - operation=$(echo $row | cut -d \| -f 2) - destination=$(echo $row | cut -d \| -f 3) - - case $operation in - symlink) - symlink_file $filename $destination - ;; - - *) - echo "[WARNING] Unknown operation $operation. Skipping..." - ;; - esac + destination=$(echo $row | cut -d \| -f 2) + result=$(echo "$HOME/$destination/$filename" | sed 's/\/\//\//g') + rm -f "$result" > /dev/null + echo "info: removed $result symlink" done } -echo "--- Configs ---" -deploy_manifest MANIFEST +[ "$1" = "clean" ] && clean && exit +deploy_manifest
