diff options
-rwxr-xr-x | lo-status | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -2,13 +2,26 @@ cd "$(dirname "$0")" +if [ -f '/mnt/key/192.168.0.1' ]; then + ${gpg_options}='--passphrase-file /mnt/key/192.168.0.1' +fi + +credentials=$( + gpg -d ${gpg_options} --no-tty --batch -o - credentials.gpg 2>/dev/null +) +err=$? +if [ ${err} -ne 0 ]; then + >&2 echo 'gpg decrypt error' + exit ${err} +fi + curl \ -Ss \ --resolve backup-lo.ddns.eckner.net:443:backup-lo.vpn.ddns.eckner.net:443 \ 'https://backup-lo.ddns.eckner.net/chassis.html' \ --cacert backup-lo.crt \ --digest \ - --user "$(gpg -d -o - credentials.gpg 2>/dev/null)" \ + --user "${credentials}" \ | sed ' s,^.*<TR><TD><STRONG>Power Status:</STRONG></TD><TD>\([^<>]*\)</TD></TR>.*$,\1, t |