diff options
author | Anton Khirnov <anton@khirnov.net> | 2020-11-25 08:08:41 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2020-11-25 08:08:41 +0100 |
commit | 779c37847d9e6676ced5a5c9c608d47f3d42e5b5 (patch) | |
tree | a529eaf25dcc21bedf48809c73153554839bfb31 /cron | |
parent | 0efa54572e3c0cce50298e4aa5b9c0f34793c0aa (diff) |
cron/dotfiles_status: do not hardcode dotfiles dir
Diffstat (limited to 'cron')
-rwxr-xr-x | cron/dotfiles_status | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/cron/dotfiles_status b/cron/dotfiles_status index d8b617a..bb3caf7 100755 --- a/cron/dotfiles_status +++ b/cron/dotfiles_status @@ -3,10 +3,16 @@ # check that the dotfiles repository is up-to-date and clean # otherwise create the dirty stamp file -dotfiles_dir=~/.config/dotfiles +script_path=$(realpath "$0") +script_dir=$(dirname "${script_path}") +dotfiles_dir=$(realpath "${script_dir}/..") + dirty_stamp=~/.local/var/dotfiles/dirty -[ -d "${dotfiles_dir}" ] || (echo "no dotfiles dir" && exit 1) +if [ ! -d "${dotfiles_dir}" ]; then + echo "no dotfiles dir" + exit 1 +fi git -C "${dotfiles_dir}" fetch -q --all || (echo "error updating remote" && exit 1) count=$(git -C "${dotfiles_dir}" rev-list --left-right --count '@{upstream}'...HEAD 2>/dev/null | grep -v '^0\s0$') |