Renamed env vars.

This commit is contained in:
Otho 2023-01-16 22:08:50 -05:00
parent ab3edb1d51
commit 5ede78973a
Signed by: Otho
GPG Key ID: 16C720CD3BBE21D9

View File

@ -34,7 +34,7 @@ SNAPSHOT_DATASETS=""
debug() debug()
{ {
if [ "$BG_DEBUG_MODE" = "TRUE" ]; then if [ "$ZB_DEBUG_MODE" = "TRUE" ]; then
echo $@ echo $@
fi fi
} }
@ -103,7 +103,7 @@ list_remote_datasets() {
dataset=`echo \\$dataset|cut -d: -f2` dataset=`echo \\$dataset|cut -d: -f2`
zfs list -H $zroot\$dataset; zfs list -H $zroot\$dataset;
done'" done'"
if [ $BG_TEST_MODE = "TRUE" ]; then if [ $ZB_TEST_MODE = "TRUE" ]; then
echo ssh $SSH_SEND_OPTS -o port=$ssh_port $user@$addr $run_cmd echo ssh $SSH_SEND_OPTS -o port=$ssh_port $user@$addr $run_cmd
else else
ssh $SSH_SEND_OPTS -o port=$ssh_port $user@$addr $run_cmd ssh $SSH_SEND_OPTS -o port=$ssh_port $user@$addr $run_cmd
@ -133,7 +133,7 @@ zfs_allow_origin()
{ {
for dataset in $SEND_DATASETS; do for dataset in $SEND_DATASETS; do
dataset=`echo $dataset|cut -d: -f1` dataset=`echo $dataset|cut -d: -f1`
if [ $BG_TEST_MODE = "TRUE" ]; then if [ $ZB_TEST_MODE = "TRUE" ]; then
echo zfs allow -u $LOCAL_USER $ORIGIN_PERMS $dataset echo zfs allow -u $LOCAL_USER $ORIGIN_PERMS $dataset
else else
zfs allow -u $LOCAL_USER $ORIGIN_PERMS $dataset zfs allow -u $LOCAL_USER $ORIGIN_PERMS $dataset
@ -157,7 +157,7 @@ zfs_allow_mirrors()
zfs allow -u $user $MIRROR_PERMS $zroot\$dataset zfs allow -u $user $MIRROR_PERMS $zroot\$dataset
done done
" "
if [ $BG_TEST_MODE = "TRUE" ]; then if [ $ZB_TEST_MODE = "TRUE" ]; then
echo ssh $SSH_SEND_OPTS -o port=$ssh_port $user@$addr $run_cmd echo ssh $SSH_SEND_OPTS -o port=$ssh_port $user@$addr $run_cmd
else else
@ -170,7 +170,7 @@ create_snapshots()
{ {
snapshot_id="`date -I`-`date +%s`-$LOCAL_TZ" snapshot_id="`date -I`-`date +%s`-$LOCAL_TZ"
for dataset in $SNAPSHOT_DATASETS; do for dataset in $SNAPSHOT_DATASETS; do
if [ $BG_TEST_MODE = "TRUE" ]; then if [ $ZB_TEST_MODE = "TRUE" ]; then
echo zfs snapshot $ZFS_SNAPSHOT_OPTS $dataset@$snapshot_id echo zfs snapshot $ZFS_SNAPSHOT_OPTS $dataset@$snapshot_id
else else
zfs snapshot $ZFS_SNAPSHOT_OPTS $dataset@$snapshot_id zfs snapshot $ZFS_SNAPSHOT_OPTS $dataset@$snapshot_id
@ -200,7 +200,7 @@ send_latest()
$user@$addr \ $user@$addr \
zfs recv $ZFS_RECV_OPTS $zroot$remote_dataset zfs recv $ZFS_RECV_OPTS $zroot$remote_dataset
" "
if [ $BG_TEST_MODE = "TRUE" ]; then if [ $ZB_TEST_MODE = "TRUE" ]; then
echo $run_cmd echo $run_cmd
else else
$run_cmd $run_cmd
@ -232,7 +232,7 @@ send_increment()
ssh $SSH_SEND_OPTS -o port=$ssh_port $user@$addr \ ssh $SSH_SEND_OPTS -o port=$ssh_port $user@$addr \
zfs recv $ZFS_RECV_OPTS $zroot$remote_dataset zfs recv $ZFS_RECV_OPTS $zroot$remote_dataset
" "
if [ $BG_TEST_MODE = "TRUE" ]; then if [ $ZB_TEST_MODE = "TRUE" ]; then
echo $run_cmd echo $run_cmd
else else
$run_cmd $run_cmd
@ -249,15 +249,15 @@ set -- `getopt "tdl:" "$@"` || {
echo "Usage: `basename $0` [-tdl] [command]" 1>&2 echo "Usage: `basename $0` [-tdl] [command]" 1>&2
exit 1 exit 1
} }
BG_TEST_MODE=FALSE ZB_TEST_MODE=FALSE
while :; do while :; do
case "$1" in case "$1" in
-t) -t)
BG_TEST_MODE=TRUE ZB_TEST_MODE=TRUE
echo Test mode. echo Test mode.
;; ;;
-d) -d)
BG_DEBUG_MODE=TRUE ZB_DEBUG_MODE=TRUE
ZFS_SEND_OPTS="$ZFS_SEND_OPTS -v" ZFS_SEND_OPTS="$ZFS_SEND_OPTS -v"
# Current on by default. # Current on by default.
# ZFS_RECV_OPTS="$ZFS_RECV_OPTS -v" # ZFS_RECV_OPTS="$ZFS_RECV_OPTS -v"