dot/update.sh

48 lines
1.9 KiB
Bash
Raw Normal View History

2024-06-18 11:40:44 +00:00
#!/bin/bash
#
# minimal dotfile manager
# tracks files / copies them into the repo, sorted by hostname
#
2024-06-20 11:57:39 +00:00
# known limitations/problems:
# - new top level directories (ie: '.config', '.local') may need to be created/seeded for new hosts
# - failure to put slashes after directories may lead to them being nested on re-runs
#
2024-06-18 13:28:13 +00:00
set -u
2024-06-18 11:40:44 +00:00
2024-06-19 12:01:31 +00:00
# array of files/dirs [relative to home] to include
2024-06-18 11:40:44 +00:00
DOTS=(
'.bashrc'
# '.shell_aliases' # needs cleaned up first
2024-06-18 11:40:44 +00:00
'.vimrc'
'.config/fuzzel/'
2024-06-29 14:50:01 +00:00
'.config/fontconfig'
'.config/kitty/'
2024-06-18 11:40:44 +00:00
'.config/nvim/init.vim'
'.config/nvim/coc-settings.json'
2024-06-18 13:28:13 +00:00
'.config/autostart-i3ipc.yml'
'.config/sway/'
2024-06-20 21:11:32 +00:00
'.config/swayidle/config'
'.config/swaylock/config'
'.local/bin/backup_home'
2024-06-19 13:19:50 +00:00
'.local/bin/note-taker.sh' # run by Kitty in a 'triplesplit' session, one of many of autostart 'wants' in '...-i3ipc.yml' above
2024-06-21 20:01:39 +00:00
'.vim/autoload/' # vim-plug, mainly
2024-06-22 16:44:18 +00:00
# Until I find/make custom modules worthwhile, including *only* the config/styling
'.config/waybar/config'
'.config/waybar/styles/'
'.config/waybar/style.css' # symlink to the wanted stylesheet (in the 'styles' dir')
2024-06-18 11:40:44 +00:00
)
2024-06-19 11:23:55 +00:00
# to avoid hacky pwd/dirname stuff w/ $0 [for now?], inline the path to the repo where copies are held
DOT_DIR="${HOME}/git/dot"
2024-06-19 12:01:31 +00:00
# ensure the host running this script/updating dotfiles has a directory within the repo
2024-06-19 13:19:50 +00:00
# then, begin dotfile processing - ensure structure is retained, naively copy w/ rsync
# at the end/out of band: rely on Git to tell us about changes. TODO: reconsider, edge cases? auto commit/push?
2024-06-19 12:01:31 +00:00
HOST_DIR="${DOT_DIR}/${HOSTNAME}"
[ -d "$HOST_DIR" ] || mkdir -v "$HOST_DIR"
2024-06-18 13:28:13 +00:00
2024-06-18 11:40:44 +00:00
for DOT in "${DOTS[@]}"; do
echo "Copying '$HOME/$DOT' to '$HOST_DIR/${DOT}'"
rsync -aqv "$HOME/$DOT" "$HOST_DIR/${DOT}" || echo "Couldn't copy '$DOT', got rc: $?"
2024-06-18 11:40:44 +00:00
done