From 800bc9473c87b24108f61dcaddb9d764664066ea Mon Sep 17 00:00:00 2001 From: root Date: Sun, 19 Mar 2017 16:19:50 +0100 Subject: [PATCH] pd and py files detection --- sbin/thewhispererindarkness.sh | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/sbin/thewhispererindarkness.sh b/sbin/thewhispererindarkness.sh index 25cfcbd..249ab21 100755 --- a/sbin/thewhispererindarkness.sh +++ b/sbin/thewhispererindarkness.sh @@ -1,17 +1,28 @@ #!/bin/sh # -FLOPPY="/dev/sda" +FD="/dev/sda" +FLOPPY="/media/floppy" +MAINPY="${FLOPPY}/main.py" +MAINPD="${FLOPPY}/main.pd" -stdbuf -oL -- udevadm monitor --udev -p ${FLOPPY} | while read -r -- STATE _ _ _ _ +stdbuf -oL -- udevadm monitor --udev -p ${FD} | while read -r -- STATE _ _ _ _ do if [ "${STATE}" = "DISK_MEDIA_CHANGE=1" ] then echo "change detected" - if [ "$(udisksctl info -b ${FLOPPY} | grep filesystem)" ] + if [ "$(udisksctl info -b ${FD} | grep filesystem)" ] then echo "floppy in (fs detected)" - udisksctl mount -b ${FLOPPY} --no-user-interaction + udisksctl mount -b ${FD} --no-user-interaction + if [ -e "${MAINPY}" ] + then + echo "main.py found" + fi + if [ -e "${MAINPD}" ] + then + echo "main.pd found" + fi else echo "floppy out (no fs detected)" fi