diff --git a/README.md b/README.md index 86fdc50..cf2d897 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,11 @@ Copy the dotfiles folder to the location where you want to keep it and then run Installs oh-my-zsh and sources aliases.sh, functions.sh and colors.sh, as well as installing a a few utilities (see `install.sh`). +A self-update mechanism is included. It asks for confirmation to pull the latest changes +from the git repo every two weeks. This also updates the git-sourced repositories installed +by the install script. The self-update routine can be called manually by calling +`dotfiles_selfupdate` (defined in `functions.sh`). + ### Installed ### 0. oh-my-zsh (zsh config framework, lots of plugins available at https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins) diff --git a/check_for_update.sh b/check_for_update.sh index 08384ba..60ed0bf 100755 --- a/check_for_update.sh +++ b/check_for_update.sh @@ -15,12 +15,12 @@ function _update_dotfiles_update() { } function _upgrade_dotfiles() { - (cd $DOTFILES; git pull --rebase &>/dev/null && echo "Succesfully upgraded dotfiles" || echo "Could not upgrade dotfiles") + (cd $DOTFILES; git pull -q --rebase && echo "Succesfully upgraded dotfiles" || echo "Could not upgrade dotfiles.") # amix's vimrc update amix_vimrc=$HOME/.vim_runtime if [[ -d $amix_vimrc ]]; then # the update_plugins.py script makes the vim_runtime dir dirty, so we have to reset --hard - (cd $amix_vimrc && git reset --hard HEAD >/dev/null && git pull --rebase >/dev/null && echo "Upgraded amix's vimrc" || echo "Could not upgrade amix's vimrc" >&2) + (cd $amix_vimrc && git reset --hard HEAD >/dev/null && git pull -q --rebase && echo "Upgraded amix's vimrc" || echo "Could not upgrade amix's vimrc" >&2) (python $amix_vimrc/update_plugins.py >/dev/null || echo "upgraded amix's vimrc's plugins || "echo "Could not upgrade amix's vimrc's plugins" >&2) else echo "Could not upgrade amix's vimrc and plugins (missing .vim_runtime folder)" >&2 @@ -29,7 +29,7 @@ function _upgrade_dotfiles() { # custom zsh plugins custom_plugins=("alias-tips" "fast-syntax-highlighting" "zsh-autosuggestions") for plugin in $custom_plugins; do - (cd $ZSH/custom/plugins/$plugin && git pull --rebase >/dev/null && echo "Upgraded oh-my-zsh plugin: $plugin" || echo "Could not upgrade oh-my-zsh plugin: $plugin" >&2) + (cd $ZSH/custom/plugins/$plugin && git pull -q --rebase && echo "Upgraded oh-my-zsh plugin: $plugin" || echo "Could not upgrade oh-my-zsh plugin: $plugin" >&2) done # update the zsh file diff --git a/functions.sh b/functions.sh index e049f69..9833f0a 100755 --- a/functions.sh +++ b/functions.sh @@ -4,18 +4,7 @@ ## Selfupdate function dotfiles_selfupdate { - # Pull dotfiles - (cd $DOTFILES; git pull --rebase) - WD=$PWD - # Update all git repos in $ZSH/custom/plugins - cd "$ZSH/custom/plugins" - for folder in *; do - if [[ -f "$folder/.git" ]]; then - (cd $folder; git pull) - fi - done - # go back to previous working directory - cd "$WD" + (. $DOTFILES/check_for_update.sh && _upgrade_dotfiles) } ## get cheat sheets for commands from cheat.sh. Usage: cheat commandname