pd and py files detection

master
root 7 years ago
parent a8934a7ffc
commit 800bc9473c

@ -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

Loading…
Cancel
Save