diff options
author | Jacob Janzen <jjanzenn@proton.me> | 2024-08-07 15:15:44 -0500 |
---|---|---|
committer | Jacob Janzen <jjanzenn@proton.me> | 2024-08-07 15:15:44 -0500 |
commit | 8a64f31f035db096f8a4a578d6b461fad4dac244 (patch) | |
tree | ae681e9dea98d3b2d0a64888769e86ef71a71129 /update-home.sh | |
parent | 341c3be75228dbd23fd05208d148acecf950d573 (diff) |
more robust update script
Diffstat (limited to 'update-home.sh')
-rwxr-xr-x | update-home.sh | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/update-home.sh b/update-home.sh new file mode 100755 index 0000000..03b39a4 --- /dev/null +++ b/update-home.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +# install the dotfiles source if it is not present +if ! test -d ~/.dotfiles; then + echo Installing dotfiles... + git clone git@git.sr.ht:~jjanzen/.dotfiles ~/.dotfiles +fi + +if ! diff ~/.dotfiles/update-home ~/.local/bin/update-home; then + cp ~/.dotfiles/update-home ~/.local/bin/update-home || exit 1 + echo Changes have been made to the update-home script. + echo Running the new update-home script. + ~/.local/bin/update-home + exit +fi + +# save the current working directory and move to the dotfiles repository +CWD=$(pwd) +cd ~/.dotfiles || exit +git stash +git checkout main +git pull --rebase + +find -- * -type f -name "*.org" | while read -r file; do + echo Installing "${file}" configuration... + # emacs --batch "${file}" -f package-initialize --eval '(org-babel-tangle)' +done + +cd "${CWD}" || exit |