Advertisement
Guest User

Untitled

a guest
Oct 2nd, 2014
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. # set the mountpoint name according to partition or device name
  4. mount_point=$ID_FS_LABEL
  5. if [ -z $mount_point ]; then
  6. mount_point=${DEVNAME##*/}
  7. fi
  8.  
  9. # if a plugdev group exist, retrieve it's gid set & it as owner of mountpoint
  10. plugdev_gid="$(grep plugdev /etc/group|cut -f3 -d:)"
  11. if [ -z $plugdev_gid ]; then
  12. gid=''
  13. else
  14. chown root:plugdev $mount_point
  15. gid=",gid=$plugdev_gid"
  16. fi
  17.  
  18. # create the mountpoint directory in /media/ (if not empty)
  19. if [ -n $mount_point ]; then
  20. mkdir -p /media/$mount_point
  21. # other options (breaks POSIX): noatime,nodiratime,nosuid,nodev
  22. mount -t $ID_FS_TYPE
  23. -o rw,flush,user,uid=0$gid,umask=002,dmask=002,fmask=002
  24. $DEVNAME /media/$mount_point
  25. fi
  26.  
  27. #!/bin/sh
  28.  
  29. # set the mountpoint name according to partition or device name
  30. mount_point=$ID_FS_LABEL
  31. if [ -z $mount_point ]; then
  32. mount_point=${DEVNAME##*/}
  33. fi
  34.  
  35. # remove the mountpoint directory from /media/ (if not empty)
  36. if [ -n $mount_point ]; then
  37. umount -l /media/$mount_point
  38. rm -R /media/$mount_point
  39. fi
  40.  
  41. ENV{DEVTYPE}=="partition", RUN+="/lib/udev/storage-automount.sh", ENV{REMOVE_CMD}="/lib/udev/storage-autounmount.sh"
  42.  
  43. $ udevadm monitor --env
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement