diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rwxr-xr-x | install.sh | 11 | ||||
-rwxr-xr-x | nvim/install.sh | 4 | ||||
-rwxr-xr-x | pass/install.sh | 4 |
4 files changed, 17 insertions, 3 deletions
@@ -1,2 +1,3 @@ !/*/** +.installed .untracked @@ -1,13 +1,18 @@ #!/bin/sh -# shellcheck disable=SC2035 +# shellcheck disable=SC2035,SC2086 set -e CDPATH='' cd -- "$(dirname -- "$0")" || exit +if [ -r .installed ]; then + read -r DOTFILES_INSTALLED <.installed + export DOTFILES_INSTALLED +fi + printf "%s: Removing bad links\n" "$0" { - git log --name-only --no-renames --diff-filter=D --format=format: + git log --name-only --no-renames --diff-filter=D --format=format: $DOTFILES_INSTALLED HEAD git diff --name-only --no-renames --diff-filter=D HEAD if [ -f .untracked ]; then cat .untracked @@ -30,3 +35,5 @@ printf "%s: Installing packages\n" "$0" for f in ${1:-*}/install.sh; do $f done + +git rev-parse ^@ >.installed diff --git a/nvim/install.sh b/nvim/install.sh index 556e188..72c3f39 100755 --- a/nvim/install.sh +++ b/nvim/install.sh @@ -7,6 +7,10 @@ if ! command -v "$pkgname" >/dev/null; then exit 0 fi +if test .installed -nt $pkgname; then + exit 0 +fi + printf "%s: Installing plugins\n" "$0" nvim --headless -c 'Lazy! restore' -c qa diff --git a/pass/install.sh b/pass/install.sh index f91caf4..54d1b8d 100755 --- a/pass/install.sh +++ b/pass/install.sh @@ -16,7 +16,9 @@ if [ ! -d "$store" ]; then else printf "%s: Syncing password-store\n" "$0" - git -C "$store" remote update origin + if [ "$(date "+%s" -r "$store"/.git/FETCH_HEAD)" -lt "$(date +%s --date="12 hour ago")" ]; then + git -C "$store" remote update origin + fi LOCAL=$(git -C "$store" rev-parse @) REMOTE=$(git -C "$store" rev-parse '@{u}') |