#!/bin/bash
if [ "$ACTION" = "add" ]
then
echo "+">>/tmp/testrules
printenv >> /tmp/testrules
fsck.vfat -aw $DEVNAME >> /tmp/testrules
sleep 0.1
sync
fsck.vfat -aw $DEVNAME >> /tmp/testrules
sleep 0.1
sync
fsck.vfat -aw $DEVNAME >> /tmp/testrules
sleep 0.1
sync
fsck.vfat -aw $DEVNAME >> /tmp/testrules
sleep 0.1
sync
mount $DEVNAME /mnt/mountLego >> /tmp/testrules
rm -R /mnt/mountLego/*
fsck.vfat -aw $DEVNAME >> /tmp/testrules
sleep 0.1
sync
fsck.vfat -aw $DEVNAME >> /tmp/testrules
sleep 0.1
sync
fsck.vfat -aw $DEVNAME >> /tmp/testrules
sleep 0.1
sync
fsck.vfat -aw $DEVNAME >> /tmp/testrules
sleep 0.1
sync
umount $DEVNAME >> /tmp/testrules
fsck.vfat -aw $DEVNAME >> /tmp/testrules
sleep 0.1
sync
fsck.vfat -aw $DEVNAME >> /tmp/testrules
sleep 0.1
sync
fsck.vfat -aw $DEVNAME >> /tmp/testrules
sleep 0.1
sync
fsck.vfat -aw $DEVNAME >> /tmp/testrules
sleep 0.1
sync
mount $DEVNAME /mnt/mountLego >> /tmp/testrules
rm -R /mnt/mountLego/*
umount $DEVNAME >> /tmp/testrules
elif [ "$ACTION" = "remove" ]
then
echo "-">>/tmp/testrules
fi