implement --commit option for stating PA cookie directly
This commit is contained in:
parent
01dffe289a
commit
e32fb0a9d2
1 changed files with 24 additions and 5 deletions
|
@ -24,8 +24,10 @@ usage() {
|
|||
cat >&2 <<EOF
|
||||
Usage: $0 [OPTIONS] OPERATION
|
||||
Options:
|
||||
--debug Enable additional debug output for start and stop operations.
|
||||
--no-gui Do not display GUI dialogs, use terminal for input and output.
|
||||
--debug Enable additional debug output for start and stop operations.
|
||||
--no-gui Do not display GUI dialogs, use terminal for input and output.
|
||||
--cookie COOKIE Pass Pulseaudio cookie of remote host as option value instead
|
||||
of copying it from remote_host.
|
||||
Operations:
|
||||
setup Interactively gather settings.
|
||||
start Start redirection to remote host.
|
||||
|
@ -273,9 +275,15 @@ do_status() {
|
|||
return "$rv"
|
||||
}
|
||||
|
||||
# Acquire PulseAudio cookie from remote host
|
||||
# Use PulseAudio cookie from --cookie option value or remote host
|
||||
sync_pa_cookie() {
|
||||
if _scp "$remote_user"@"$remote_ip":.config/pulse/cookie ~/.config/pulse/cookie ; then
|
||||
if ! [[ -d ~/.config/pulse ]] || ! [[ -w ~/.config/pulse ]] ; then
|
||||
error "Local directory ~/.config/pulse does not exist or is not writeable."
|
||||
return 1
|
||||
elif [[ -n $cookie ]] ; then
|
||||
debug "Using PulseAudio cookie value as passed on the command line ..."
|
||||
printf "%s" "$cookie" > ~/.config/pulse/cookie
|
||||
elif _scp "$remote_user"@"$remote_ip":.config/pulse/cookie ~/.config/pulse/cookie ; then
|
||||
debug "Synced PulseAudio cookie from remote host $remote_ip."
|
||||
return 0
|
||||
else
|
||||
|
@ -457,9 +465,15 @@ do_stop() {
|
|||
# Arguments
|
||||
|
||||
operation=
|
||||
cookie=
|
||||
no_more_options=false
|
||||
# shellcheck disable=SC2034
|
||||
|
||||
while [[ $# -gt 0 ]] ; do
|
||||
arg=$1
|
||||
shift
|
||||
echo "DEBUG: parsing arg=$arg .." >&2
|
||||
|
||||
for arg in "$@" ; do
|
||||
case "$arg" in
|
||||
--)
|
||||
no_more_options=true
|
||||
|
@ -467,6 +481,11 @@ for arg in "$@" ; do
|
|||
--*)
|
||||
"$no_more_options" && { gui=false error "Option arguments may not preceed non-option arguments." ; exit 1 ; }
|
||||
;;&
|
||||
--cookie)
|
||||
[[ $# -eq 0 ]] && { gui=false error "Missing argument for option \"--cookie\"" ; exit 1 ; }
|
||||
cookie=$1
|
||||
shift
|
||||
;;
|
||||
--debug)
|
||||
debug_cmdline=true
|
||||
;;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue