Merge pull request #94 from aimileus/macos

Support macOS with Homebrew gnu-getopt
This commit is contained in:
Jonathan Carter 2019-09-25 15:10:13 +02:00 committed by GitHub
commit 363a847ee3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -224,7 +224,13 @@ do_snapshots () # properties, flags, snapname, oldglob, [targets...]
# main ()
# {
GETOPT=$(getopt \
if [ "$(uname)" == "Darwin" ]; then
GETOPT_BIN="$(brew --prefix gnu-getopt 2> /dev/null || echo /usr/local)/bin/getopt"
else
GETOPT_BIN="getopt"
fi
GETOPT=$($GETOPT_BIN \
--longoptions=default-exclude,dry-run,fast,skip-scrub,recursive \
--longoptions=event:,keep:,label:,prefix:,sep: \
--longoptions=debug,help,quiet,syslog,verbose \
@ -578,7 +584,7 @@ SNAPPROP="-o com.sun:auto-snapshot-desc='$opt_event'"
# ISO style date; fifteen characters: YYYY-MM-DD-HHMM
# On Solaris %H%M expands to 12h34.
DATE=$(date --utc +%F-%H%M)
DATE=$(date -u +%F-%H%M)
# The snapshot name after the @ symbol.
SNAPNAME="${opt_prefix:+$opt_prefix$opt_sep}${opt_label:+$opt_label}-$DATE"