From a8934a7ffc00e3f42879bb96088c748f6f6382ff Mon Sep 17 00:00:00 2001 From: root Date: Sun, 19 Mar 2017 16:04:37 +0100 Subject: [PATCH] FLOPPY dev as var + better fs check --- sbin/thewhispererindarkness.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sbin/thewhispererindarkness.sh b/sbin/thewhispererindarkness.sh index 42c244a..25cfcbd 100755 --- a/sbin/thewhispererindarkness.sh +++ b/sbin/thewhispererindarkness.sh @@ -1,15 +1,17 @@ #!/bin/sh +# +FLOPPY="/dev/sda" -stdbuf -oL -- udevadm monitor --udev -p /sys/block/sda | while read -r -- STATE _ _ _ _ +stdbuf -oL -- udevadm monitor --udev -p ${FLOPPY} | while read -r -- STATE _ _ _ _ do - if [ "$STATE" = "DISK_MEDIA_CHANGE=1" ] + if [ "${STATE}" = "DISK_MEDIA_CHANGE=1" ] then echo "change detected" - if udisksctl info -b /dev/sda | grep filesystem + if [ "$(udisksctl info -b ${FLOPPY} | grep filesystem)" ] then echo "floppy in (fs detected)" - udisksctl mount --block-device /dev/sda --no-user-interaction + udisksctl mount -b ${FLOPPY} --no-user-interaction else echo "floppy out (no fs detected)" fi