Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Only operate on sdb1
- KERNEL!="sdb1", GOTO="usb-automount-end"
- ACTION=="add", PROGRAM!="/sbin/blkid %N", GOTO="usb-automount-end"
- #import useful variables from blkid program
- IMPORT{program}="/sbin/blkid -o udev -p %N"
- #ignore anything other than vfat filesystems
- ACTION=="add", ENV{ID_FS_TYPE}!="vfat", GOTO="usb-automount-end"
- #remount root as read-write. Not sure why we have to do this!
- #ACTION=="add", RUN+="/bin/mount -o remount,rw /"
- #mount to /mnt/flash
- #ACTION=="add", RUN+="/bin/mkdir -p /mnt/flash"
- #ACTION=="add", RUN+="/bin/mount -t vfat -o dmask=000,fmask=111 /dev/%k /mnt/flash"
- ACTION=="add", RUN+="/root/test_run.sh", OPTIONS="last_rule"
- #clean up after removal
- #ACTION=="remove", RUN+="/bin/umount -l /mnt/flash"
- #label for goto end
- LABEL="usb-automount-end"
- #!/bin/bash -x
- logger "running mount"
- mount | logger
- logger "remounting root"
- mount -o remount,rw / 2>&1 | logger
- logger "remount done"
- mount | logger
- logger "Running script. Adding dir"
- mkdir -p /mnt/flash2 2>&1 | logger
- logger "Directory added... mounting."
- mount -t vfat -o dmask=000,fmask=111 /dev/sdb1 /mnt/flash2 2>&1 | logger
- logger "Mounted"
- mount | logger
- logger "Sleeping 5 then re-checking"
- sleep 5
- mount | logger
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement