forked from extern/zfs-auto-snapshot
Merge pull request #94 from aimileus/macos
Support macOS with Homebrew gnu-getopt
This commit is contained in:
commit
363a847ee3
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user