ssh_filter_btrbk: correctly handle --sudo option

pull/135/head
Axel Burri 2017-03-17 21:22:13 +01:00
parent 3b7ede773a
commit da70158c24
3 changed files with 10 additions and 3 deletions

View File

@ -1,6 +1,8 @@
btrbk-current
* MIGRATION
- If you call ssh_filter_btrbk.sh with "--sudo" option, make sure
to set "backend btrfs-progs-sudo" in btrbk.conf for this host.
- If "rate_limit" is enabled, update ssh_filter_btrbk.sh on remote
source hosts, and make sure the "pv" command is available there.
* Allow converting backup disks to source disks (close #114).

View File

@ -89,7 +89,8 @@ Log ACCEPT and REJECT messages to the system log.
.PP
\-\-sudo
.RS 4
Call SSH_ORIGINAL_COMMAND using sudo.
Allow btrfs commands to be called via sudo. Enable this if you have
"backend btrfs-progs-sudo" in your btrbk configuration file.
.RE
.SH AVAILABILITY
Please refer to the btrbk project page \fBhttp://digint.ch/btrbk/\fR

View File

@ -89,8 +89,12 @@ reject_filtered_cmd()
}
# FIXME: "--sudo" must be set before all other options!
# check for "--sudo" option before processing other options
sudo_prefix=
for key; do
[[ "$key" == "--sudo" ]] && sudo_prefix="sudo -n "
done
while [[ "$#" -ge 1 ]]; do
key="$1"
@ -100,7 +104,7 @@ while [[ "$#" -ge 1 ]]; do
;;
--sudo)
sudo_prefix="sudo -n "
# already processed above
;;
-p|--restrict-path)