Skip to content

Commit 25bc0d4

Browse files
committed
Merge branch 'pvalkone-freebsd-portability-fixes'
Closes adaugherity#4. Resolved Conflicts: zfs-backup.sh
2 parents 861eb6e + ec56f84 commit 25bc0d4

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

zfs-backup.sh

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/ksh
1+
#!/usr/bin/env ksh
22
# /usr/xpg4/bin/sh and /bin/bash also work; /bin/sh does not
33

44
# backup script to replicate a ZFS filesystem and its children to another
@@ -64,6 +64,8 @@ LOCK="/var/tmp/zfsbackup.lock"
6464
PID="/var/tmp/zfsbackup.pid"
6565
CFG="/var/lib/zfssnap/zfs-backup.cfg"
6666
ZFS="/usr/sbin/zfs"
67+
# Replace with sudo(8) if pfexec(1) is not available on your OS
68+
PFEXEC=`which pfexec`
6769

6870
# local settings -- datasets to back up are now found by property
6971
TAG="zfs-auto-snap_daily"
@@ -231,10 +233,10 @@ do_backup() {
231233
fi
232234

233235
if [ $DEBUG ]; then
234-
echo "would run: $ZFS send -R -I $snap1 $DATASET@$snap2 |"
235-
echo " $REMZFS_CMD recv $RECV_OPT -vF $REMPOOL"
236+
echo "would run: $PFEXEC $ZFS send -R -I $snap1 $DATASET@$snap2 |"
237+
echo " $REMZFS_CMD recv $VERBOSE $RECV_OPT -F $REMPOOL"
236238
else
237-
if ! pfexec $ZFS send -R -I $snap1 $DATASET@$snap2 | \
239+
if ! $PFEXEC $ZFS send -R -I $snap1 $DATASET@$snap2 | \
238240
$REMZFS_CMD recv $VERBOSE $RECV_OPT -F $REMPOOL; then
239241
echo 1>&2 "Error sending snapshot."
240242
touch $LOCK

0 commit comments

Comments
 (0)