fix for ntfs usb-disc
This commit is contained in:
@@ -1,4 +1,9 @@
|
|||||||
#!/bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
|
#######################################
|
||||||
|
# USB Flash Drives automounting #
|
||||||
|
#######################################
|
||||||
|
|
||||||
# start at sdb to ignore the system hard drive
|
# start at sdb to ignore the system hard drive
|
||||||
KERNEL!="sd[b-z]*", GOTO="exit"
|
KERNEL!="sd[b-z]*", GOTO="exit"
|
||||||
ACTION=="add", PROGRAM!="/sbin/blkid %N", GOTO="exit"
|
ACTION=="add", PROGRAM!="/sbin/blkid %N", GOTO="exit"
|
||||||
@@ -16,16 +21,53 @@ ACTION=="add", RUN+="/bin/mkdir -p '/media/%E{dir_name}'"
|
|||||||
# global mount options
|
# global mount options
|
||||||
#ACTION=="add", ENV{mount_options}="relatime"
|
#ACTION=="add", ENV{mount_options}="relatime"
|
||||||
|
|
||||||
# filesystem-specific mount options (777/666 dir/file perms for vfat)
|
# filesystem-specific mount options (777/666 dir/file perms for ntfs/vfat)
|
||||||
ACTION=="add",ENV{mount_options_vfat}="gid=100,dmask=000,fmask=111,utf8,flush,rw,noatime,users"
|
|
||||||
|
|
||||||
|
|
||||||
|
########
|
||||||
|
# vfat #
|
||||||
|
########
|
||||||
|
|
||||||
|
# vfat specific mount options
|
||||||
|
ACTION=="add", ENV{mount_options_vfat}="gid=100,dmask=000,fmask=111,utf8,flush,rw,noatime,users"
|
||||||
|
|
||||||
# add device to /etc/fstab
|
# add device to /etc/fstab
|
||||||
#ACTION=="add", ENV{ID_FS_TYPE}=="vfat|ntfs", RUN+="/bin/sed -i '$a\/dev/%k /media/%E{dir_name} vfat %E{mount_options_vfat} 0 0' /etc/fstab"
|
ACTION=="add", ENV{ID_FS_TYPE}=="vfat", RUN+="/bin/sed -i '$a\/dev/%k /media/%E{dir_name} vfat %E{mount_options_vfat} 0 0' /etc/fstab"
|
||||||
|
|
||||||
# mount device
|
# mount device
|
||||||
ACTION=="add", ENV{ID_FS_TYPE}=="vfat|ntfs", RUN+="/bin/mount -t auto -o %E{mount_options_vfat} /dev/%k '/media/%E{dir_name}'"
|
ACTION=="add", ENV{ID_FS_TYPE}=="vfat", RUN+="/bin/mount -t auto -o %E{mount_options_vfat} /dev/%k '/media/%E{dir_name}'"
|
||||||
|
|
||||||
# clean up after device removal
|
|
||||||
|
|
||||||
|
########
|
||||||
|
# ntfs #
|
||||||
|
########
|
||||||
|
|
||||||
|
# ntfs specific mount options
|
||||||
|
ACTION=="add", ENV{mount_options_ntfs}="gid=100,dmask=000,fmask=111,utf8,flush,rw,noatime,users"
|
||||||
|
|
||||||
|
# add device to /etc/fstab
|
||||||
|
ACTION=="add", ENV{ID_FS_TYPE}=="ntfs", RUN+="/bin/sed -i '$a\/dev/%k /media/%E{dir_name} ntfs-3g %E{mount_options_ntfs} 0 0' /etc/fstab"
|
||||||
|
|
||||||
|
# mount device
|
||||||
|
ACTION=="add", ENV{ID_FS_TYPE}=="ntfs", RUN+="/bin/mount -t ntfs-3g -o %E{mount_options_ntfs} /dev/%k '/media/%E{dir_name}'"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#####################
|
||||||
|
# other filesystems #
|
||||||
|
#####################
|
||||||
|
|
||||||
|
# ntfs specific mount options
|
||||||
|
ACTION=="add", ENV{mount_options_other}="gid=100,dmask=000,fmask=111,utf8,flush,rw,noatime,users"
|
||||||
|
|
||||||
|
# automount all other filesystems
|
||||||
|
ACTION=="add", ENV{ID_FS_TYPE}!="(ntfs|vfat)", RUN+="/bin/mount -t auto -o %E{mount_options_other} /dev/%k '/media/%E{dir_name}'"
|
||||||
|
|
||||||
|
#################################
|
||||||
|
# clean up after device removal #
|
||||||
|
#################################
|
||||||
ACTION=="remove", ENV{dir_name}!="", RUN+="/bin/umount -l '/media/%E{dir_name}'", RUN+="/bin/rmdir '/media/%E{dir_name}'"
|
ACTION=="remove", ENV{dir_name}!="", RUN+="/bin/umount -l '/media/%E{dir_name}'", RUN+="/bin/rmdir '/media/%E{dir_name}'"
|
||||||
ACTION=="remove", ENV{ID_FS_TYPE}!="", RUN+="/bin/sed -i '/\/dev\/%k /d' /etc/fstab"
|
ACTION=="remove", ENV{ID_FS_TYPE}!="", RUN+="/bin/sed -i '/\/dev\/%k /d' /etc/fstab"
|
||||||
|
|
||||||
|
|||||||
@@ -123,7 +123,7 @@
|
|||||||
<Update release="6">
|
<Update release="6">
|
||||||
<Date>2016-01-03</Date>
|
<Date>2016-01-03</Date>
|
||||||
<Version>3.1.2</Version>
|
<Version>3.1.2</Version>
|
||||||
<Comment>Add rules for mount storage.</Comment>
|
<Comment>Add rules for mount storage, ntfs usb disc too.</Comment>
|
||||||
<Name>Ertuğrul Erata</Name>
|
<Name>Ertuğrul Erata</Name>
|
||||||
<Email>ertugrulerata@gmail.com</Email>
|
<Email>ertugrulerata@gmail.com</Email>
|
||||||
</Update>
|
</Update>
|
||||||
|
|||||||
Reference in New Issue
Block a user