diff options
-rwxr-xr-x | bin/impressive-display | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/bin/impressive-display b/bin/impressive-display index 965fc6c..ced9141 100755 --- a/bin/impressive-display +++ b/bin/impressive-display @@ -106,6 +106,11 @@ else OUTPUT="logger -t impressive-display" fi +# FIXME: find good regexp for usernames (incl. email addresses) +if ! echo ${DEFAULT_PDF_URL_CREDS} | grep -q -E '(^$|[-@_a-z0-9A-Z]+:.+)'; then + $OUTPUT "DEFAULT_PDF_URL_CREDS does not seem to have valid credentials (expected format: <user>:<pw>)." +fi + workdir="$HOME/.impressive-display" mkdir -p "$workdir" pdffile_previous="$workdir/impressive-pdffile-previous.pdf" @@ -167,13 +172,15 @@ else RESOLUTION="$DEFAULT_RESOLUTION" fi -set -x if echo ${!CREDS[@]} | grep -q "$THIS_HOSTNAME"; then - PDF_URL_CREDS=`echo ${CREDS[$THIS_HOSTNAME]} | sed -r -e 's/.*creds=([^|]*).*/\1/'` + if echo ${CREDS[$THIS_HOSTNAME]} | grep ":"; then + PDF_URL_CREDS="${CREDS[$THIS_HOSTNAME]}" + else + $OUTPUT "Display host '$THIS_HOSTNAME' does not seem to have valid credentials (expected format: <user>:<pw>)." + fi else PDF_URL_CREDS="$DEFAULT_PDF_URL_CREDS" fi -set +x if [ -n "${RESOLUTION}" ]; then if type -p xrandr 1>/dev/null; then |