pd and py files detection

master
root 7 years ago
parent a8934a7ffc
commit 800bc9473c

@ -1,17 +1,28 @@
#!/bin/sh #!/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 do
if [ "${STATE}" = "DISK_MEDIA_CHANGE=1" ] if [ "${STATE}" = "DISK_MEDIA_CHANGE=1" ]
then then
echo "change detected" echo "change detected"
if [ "$(udisksctl info -b ${FLOPPY} | grep filesystem)" ] if [ "$(udisksctl info -b ${FD} | grep filesystem)" ]
then then
echo "floppy in (fs detected)" 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 else
echo "floppy out (no fs detected)" echo "floppy out (no fs detected)"
fi fi

Loading…
Cancel
Save