config

OpenBSD system configuration
git clone git://jacobedwards.org/config
Log | Files | Refs | README

commit 50c638ef3886401c81e290c8ad57d332eb7e5a3b
parent 3f34cfeae115be4254c19dff21b6c2213e7d8126
Author: Jacob R. Edwards <n/a>
Date:   Sat, 12 Feb 2022 13:21:18 -0800

Various improvements to modsync

- Update usage information
- Check that changes are pulled before syncing is stopped
- Explicity exit 0 at the end (any non-zero status is due to a test)
- Rename the forcediff variable to fdiff, the same length as the rest

Diffstat:
Mlib/modsync | 17+++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/lib/modsync b/lib/modsync @@ -11,7 +11,7 @@ error() { } usererror() { - error "usage: $name [push|pull|diff|stop] [-dnop] dest module ..." + error "usage: $name [push|pull|diff|stop] [-cdfnop] dest module ..." test "${1:-}" && error "$@" } @@ -54,7 +54,7 @@ filesync() { then echo "$2" 1>&2 install "$1" "$2" - elif $forcediff || test "$1" -nt "$2" -o "$1" -ot "$2" + elif $fdiff || test "$1" -nt "$2" -o "$1" -ot "$2" then if ! diff -u "$2" "$1" 1>&2 then @@ -107,16 +107,18 @@ shift patch=true owner= perms= -forcediff=false +fdiff=false fcopy=false +force=false while expr x"$1" : x- > /dev/null do case "$1" in (-n) patch=false ;; (-o) owner="$2"; shift ;; (-p) perms="$2"; shift ;; - (-d) forcediff=true ;; + (-d) fdiff=true ;; (-c) fcopy=true ;; + (-f) force=true ;; (*) usererror "$name: '$1': Invalid option" ;; esac shift @@ -127,7 +129,14 @@ shift trap "" 0 +# Pull changes before removing +if test "$cmd" = stop && ! $force +then + "$0" pull "$dir" "$@" +fi + for mod in "$@" do modsync "$cmd" "$mod" "$dir" done +exit 0