shellcheck, better automated upgrades
[distro-setup] / system-status
index c92bc9a9656583b253d5619f8d97b9ddeffe6260..49f734a63243aee83d33f3a641583e5b53231d8c 100755 (executable)
@@ -18,16 +18,16 @@ write-status() {
   chars=()
 
   glob=(/nocow/btrfs-stale/*)
-  if [[ -e $glob ]] ; then
+  if [[ -e ${glob[0]} ]]; then
     chars+=("STALE!")
   fi
   glob=(/m/md/bounces/new/*)
-  if [[ -e $glob ]]; then
+  if [[ -e ${glob[0]} ]]; then
     chars+=("BOUNCE!")
     lo -1 bounce "message in /m/md/bounces/new"
   fi
   glob=(/m/md/alerts/new/* /m/md/alerts/cur/*)
-  if [[ -e $glob ]]; then
+  if [[ -e ${glob[0]} ]]; then
     chars+=("ALERT!")
   fi
   if [[ -e /nocow/user/mailtest-failure ]]; then
@@ -39,7 +39,7 @@ write-status() {
   fi
 
   source /a/bin/bash_unpublished/source-state
-  if [[ $MAIL_HOST == $HOSTNAME ]]; then
+  if [[ $MAIL_HOST == "$HOSTNAME" ]]; then
     if [[ $(systemctl is-active btrbk.timer) != active ]]; then
       chars+=("BTRBK.TIMER!")
       lo -60 btrbk.timer "btrbk.timer not enabled"
@@ -65,13 +65,13 @@ write-status() {
 
   cat /a/bin/bash_unpublished/source-state >$status_file
 
-  if [[ $chars ]]; then
+  if [[ ${chars[*]} ]]; then
     echo "ps_char=\"${chars[*]} \$ps_char\"" >>$status_file
   fi
 
 }
 write-status
-if [[ $@ ]]; then
+if [[ $1 ]]; then
   cat $status_file
   exit 0
 fi