update.sh: simplify
This commit is contained in:
parent
1691adc0f9
commit
c60db34e11
1 changed files with 6 additions and 8 deletions
14
update.sh
14
update.sh
|
@ -6,7 +6,7 @@
|
|||
# note: assumes pwd is this repo before running this script
|
||||
set -u
|
||||
|
||||
# array of files [relative to home] to include
|
||||
# array of files/dirs [relative to home] to include
|
||||
DOTS=(
|
||||
'.vimrc'
|
||||
'.config/nvim/init.vim'
|
||||
|
@ -18,16 +18,14 @@ DOTS=(
|
|||
# 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"
|
||||
|
||||
# ensure the host running this script/updating dotfiles has a directory
|
||||
# ... then temporarily change into it for working, or exit.
|
||||
# if it couldn't be made/entered [for whatever reason], we won't be able to copy.
|
||||
[ -d "$HOSTNAME" ] || mkdir -v "$HOSTNAME"
|
||||
# ensure the host running this script/updating dotfiles has a directory within the repo
|
||||
HOST_DIR="${DOT_DIR}/${HOSTNAME}"
|
||||
[ -d "$HOST_DIR" ] || mkdir -v "$HOST_DIR"
|
||||
|
||||
# now that the host/working dir is managed, process the dotfiles
|
||||
# ensure their directory structure is retained, naively copy w/ rsync - relying on Git to tell us about changes
|
||||
# begin dotfile processing - ensure structure is retained, naively copy w/ rsync. rely on Git to tell us about changes.
|
||||
# TODO: reconsider, edge cases?
|
||||
for DOT in "${DOTS[@]}"; do
|
||||
DEST="${DOT_DIR}/${HOSTNAME}/$DOT"
|
||||
DEST="${HOST_DIR}/$DOT"
|
||||
echo "Copying '$HOME/$DOT' to '$DEST'"
|
||||
rsync -aqv "$HOME/$DOT" "$DEST" || echo "Couldn't copy '$DOT', got rc: $?"
|
||||
done
|
||||
|
|
Loading…
Reference in a new issue