remove debug output; option --cookie expects Base64 value

This commit is contained in:
Tilman Kranz 2025-06-01 03:48:32 +02:00
parent e32fb0a9d2
commit 4c7b600c68

View file

@ -22,18 +22,19 @@
usage() { usage() {
cat >&2 <<EOF cat >&2 <<EOF
Usage: $0 [OPTIONS] OPERATION # Usage:
Options: \`$0 [OPTIONS] OPERATION\`
--debug Enable additional debug output for start and stop operations. # Options:
--no-gui Do not display GUI dialogs, use terminal for input and output. * \`--debug\`: Enable additional debug output for start and stop operations.
--cookie COOKIE Pass Pulseaudio cookie of remote host as option value instead * \`--no-gui\`: Do not display GUI dialogs, use terminal for input and output.
of copying it from remote_host. * \`--cookie COOKIE\`: Pass Pulseaudio cookie as option value instead of copying
Operations: from remote_host. Expects value to be Base64-encoded.
setup Interactively gather settings. # Operations:
start Start redirection to remote host. * \`setup\`: Interactively gather settings.
stop Stop redirection to remote host. * \`start\`: Start redirection to remote host.
restart Stop and then start redirection. * \`stop\`: Stop redirection to remote host.
status Check if redirection is set up and enabled. * \`restart\`: Stop and then start redirection.
* \`status\`: Check if redirection is set up and enabled.
EOF EOF
} }
@ -281,8 +282,13 @@ sync_pa_cookie() {
error "Local directory ~/.config/pulse does not exist or is not writeable." error "Local directory ~/.config/pulse does not exist or is not writeable."
return 1 return 1
elif [[ -n $cookie ]] ; then elif [[ -n $cookie ]] ; then
debug "Using PulseAudio cookie value as passed on the command line ..." if echo "$cookie" | base64 -d > ~/.config/pulse/cookie ; then
printf "%s" "$cookie" > ~/.config/pulse/cookie debug "Using PulseAudio cookie value as passed on the command line ..."
return 0
else
error "Decoding Base64 value of option --cookie failed."
return 1
fi
elif _scp "$remote_user"@"$remote_ip":.config/pulse/cookie ~/.config/pulse/cookie ; then elif _scp "$remote_user"@"$remote_ip":.config/pulse/cookie ~/.config/pulse/cookie ; then
debug "Synced PulseAudio cookie from remote host $remote_ip." debug "Synced PulseAudio cookie from remote host $remote_ip."
return 0 return 0
@ -472,7 +478,6 @@ no_more_options=false
while [[ $# -gt 0 ]] ; do while [[ $# -gt 0 ]] ; do
arg=$1 arg=$1
shift shift
echo "DEBUG: parsing arg=$arg .." >&2
case "$arg" in case "$arg" in
--) --)