diff --git a/src/zfs-auto-snapshot.sh b/src/zfs-auto-snapshot.sh index e4d2eda..d74a0a3 100644 --- a/src/zfs-auto-snapshot.sh +++ b/src/zfs-auto-snapshot.sh @@ -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"