4c4
< ZREP_VERSION=0.9
---
> ZREP_VERSION="0.9 OpenIndiana version"
17a18,20
> # edit by ghandalf
> mbportnbr=10000 #Set the Port for mbuffer
> # end edit by ghandalf
74a78,89
> # edit by ghandalf
> if grep 'OpenIndiana' /etc/release >/dev/null ;then
> OI=1
> else
> OI=0
> fi
>
>
> # Variable for mbuffer
> MBUFFER=0
>
> # end edit by ghandalf
650a666,674
>
> # edit by ghandalf
> if (( OI )) ; then
> SENDFLAG_OI="-vp"
> print "OpenIndiana detected; All features are available!"
> else
> SENDFLAG_OI=""
> fi
> # end edit by ghandalf
661,663c685,690
< if ((! Z_HAS_O )) ; then
< print "Sorry, your zfs is too old for zrep to handle volume initialization"
< zrep_errquit "Please initialize volume target by hand, if you won't upgrade"
---
> # edit by ghandalf
> if (( ! OI )) ; then
> if ((! Z_HAS_O )) ; then
> print "Sorry, your zfs is too old for zrep to handle volume initialization"
> zrep_errquit "Please initialize volume target by hand, if you won't upgrade"
> fi
664a692
> # end edit by ghandalf
678,680c706,720
< print Ancient local version of ZFS detected.
< print Creating destination filesystem as separate step
< zrep_ssh $desthost zfs create $ZREP_CREATE_FLAGS -o readonly=on $destfs || zrep_errquit "Cannot create $desthost:$destfs"
---
>
> # edit by ghandalf
> if (( OI )) ; then
> if (( ! vol )) ; then
> print ZFS Folder detected
> zrep_ssh $desthost zfs create $ZREP_CREATE_FLAGS -o readonly=on $destfs || zrep_errquit "Cannot create $desthost:$destfs"
> else
> print ZFS Volume detected, no filesystem created!
> fi
> else
> print Ancient local version of ZFS detected.
> print Creating destination filesystem as separate step
> zrep_ssh $desthost zfs create $ZREP_CREATE_FLAGS -o readonly=on $destfs || zrep_errquit "Cannot create $desthost:$destfs"
> fi
> # end edit by ghandalf
692,701c732,751
< if (( $Z_HAS_X )) ; then
< # This is the nice, clean, modern codepath, to send
< # zrep settings over automatically at first init
< #
< # But check to see if sending volume or filesystem first,
< # and act appropriately
< #
< typeset MOUNTFILTER
< if (( vol )) ; then
< MOUNTFILTER=""
---
> # edit by ghandalf
> if (( ! MBUFFER )) ; then
> if (( $Z_HAS_X )) ; then
> # This is the nice, clean, modern codepath, to send
> # zrep settings over automatically at first init
> #
>
> # But check to see if sending volume or filesystem first,
> # and act appropriately
> #
>
> typeset MOUNTFILTER
> if (( vol )) ; then
> MOUNTFILTER=""
> else
> MOUNTFILTER="-x mountpoint"
> fi
>
> zfs send -p $snap |
> zrep_ssh $desthost zfs recv $MOUNTFILTER $READONLYPROP -F $destfs
703,704c753,769
< MOUNTFILTER="-x mountpoint"
< fi
---
> ## arg.. Patch your systems!!
> # Doesn't support "recv -x mountpoint", so cant use -p in send
> # This means we have to manually set props lower down as well.
>
> typeset FLAG
> if (( OI )) ; then
> if (( vol )) ; then
> FLAG="-uvF"
> else
> FLAG="-vF"
> fi
> else
> FLAG="-F"
> fi
>
> zfs send $SENDFLAG_OI $snap |
> zrep_ssh $desthost zfs recv $READONLYPROP $FLAG $destfs
706,707c771
< zfs send -p $snap |
< zrep_ssh $desthost zfs recv $MOUNTFILTER $READONLYPROP -F $destfs
---
> fi
709,713c773,818
< ## arg.. Patch your systems!!
< # Doesn't support "recv -x mountpoint", so cant use -p in send
< # This means we have to manually set props lower down as well.
< zfs send $snap |
< zrep_ssh $desthost zfs recv $READONLYPROP -F $destfs
---
> if (( $Z_HAS_X )) ; then
> # This is the nice, clean, modern codepath, to send
> # zrep settings over automatically at first init
> #
> #
> # But check to see if sending volume or filesystem first,
> # and act appropriately
> #
> typeset MOUNTFILTER
> if (( vol )) ; then
> MOUNTFILTER=""
> else
> MOUNTFILTER="-x mountpoint"
> fi
>
> print 'CAUTION! There is no encryption with mbuffer, use it only in a secure enviroment!'
>
> zrep_ssh $desthost "echo \"mbuffer -m 1G -s 128k -I $mbportnbr | zfs recv $MOUNTFILTER $READONLYPROP -F $destfs > /dev/null 2>&1\" | at now"
> sleep 3
> zfs send -p $snap | mbuffer -m 1G -s 128k -O $desthost:$mbportnbr
>
>
> else
> ## arg.. Patch your systems!!
> # Doesn't support "recv -x mountpoint", so cant use -p in send
> # This means we have to manually set props lower down as well.
>
> typeset FLAG
> if (( OI )) ; then
> if (( vol )) ; then
> FLAG="-uvF"
> else
> FLAG="-vF"
> fi
> else
> FLAG="-F"
> fi
>
> print 'CAUTION! There is no encryption with mbuffer, use it only in a secure enviroment!'
>
> zrep_ssh $desthost "echo \"mbuffer -m 1G -s 128k -I $mbportnbr | zfs recv $MOUNTFILTER $READONLYPROP $FLAG $destfs > /dev/null 2>&1\" | at now"
> sleep 3
> zfs send $SENDFLAG_OI $snap | mbuffer -m 1G -s 128k -O $desthost:$mbportnbr
> fi
>
>
714a820
> # end edit by ghandalf
722c828,832
< print Debug: Because you have old zfs support, setting remote properties by hand
---
> if (( OI )) ; then
> print setting remote properties
> else
> print Debug: Because you have old zfs support, setting remote properties by hand
> fi
1397a1508,1511
> # edit by ghandalf
> print "OpenIndiana and mbuffer implementation by Ghandalf (http://hardforum.com), 2012"
> print "mbuffer implementation by Flintstone (http://hardforum.com), 2012"
> # end edit by ghandalf
1400a1515,1522
> # edit by ghandalf
> print '---'
> print 'zrep (initm|-im) ZFS/fs remotehost remoteZFSpool/fs -- mbuffer used instead of ssh for speed'
> print 'mbuffer needs to be installed on both systems!'
> print 'mbuffer uses Port $mbportnbr and 1GB RAM for buffering'
> print 'CAUTION! There is no encryption with mbuffer, use it only in a secure enviroment!'
> print '---'
> # end edit by ghandalf
1438a1561,1567
> # edit by ghandalf
> initm|-im)
> shift
> MBUFFER=1
> zrep_init "$@"
> ;;
> # end edit by ghandalf