update: robustness, include Sway

This commit is contained in:
Josh Lay 2024-06-18 08:28:13 -05:00
parent 5ff5aa3bf3
commit 0e4af5d596
No known key found for this signature in database
GPG key ID: 47AA304B2243B579

View file

@ -3,13 +3,15 @@
# minimal dotfile manager
# tracks files / copies them into the repo, sorted by hostname
#
set -u
# array of files [relative to home] to include
DOTS=(
'.vimrc'
'.config/nvim/init.vim'
'.config/nvim/coc-settings.json'
# '.config/sway'
'.config/autostart-i3ipc.yml'
'.config/sway'
)
# ensure the host running this script/updating dotfiles has a directory
@ -18,13 +20,16 @@ DOTS=(
[ -d "$HOSTNAME" ] || mkdir -v "$HOSTNAME"
pushd "$HOSTNAME" || exit
echo "Changed working dir to $PWD"
# now that the host/working dir is managed, process the dotfiles
# ensure their directory structure is retained, then recursively copy
for DOT in "${DOTS[@]}"; do
DOT_DIR="$(dirname "$DOT")"
[ -d "$DOT_DIR" ] || mkdir -vp "$DOT_DIR"
# naively copy; rely on git to tell us about changes
cp -ravp "$HOME/$DOT" "$DOT"
# naively 'copy' with rsync; rely on git to tell us about changes. TODO: reconsider
echo "Copying '$HOME/$DOT' to '$DOT'"
rsync -aqv "$HOME/$DOT" "$DOT" || echo "Couldn't copy '$DOT', got rc: $?"
done
# return where we were