This commit is contained in:
Slawomir Wojciech Wojtczak (vermaden) 2012-02-27 20:27:21 +01:00
parent e70136a4ae
commit 9ab1840305
6 changed files with 57 additions and 14 deletions

View File

@ -83,6 +83,20 @@ USERUMOUNT (set to NO by default)
system with their selected file manager.
example: USERUMOUNT="YES"
ATIME (set to YES by default)
When set to NO it will mount filesystems with
noatime options when possible.
example: ATIME="NO"
REMOVEDIRS (set to NO by default)
When set to YES it will remove empty directories
under the used ${MNTPREFIX} after device detach.
example: REMOVEDIRS="YES"
EOF
exit 0
}
@ -98,6 +112,8 @@ EOF
: ${CODEPAGE="cp437"} # US/Canada
: ${DATEFMT="%Y-%m-%d %H:%M:%S"} # 2012-02-20 07:49:09
: ${USERUMOUNT="NO"} # when YES add suid bit to umount(8)
: ${ATIME="YES"} # when NO mount with noatime
: ${REMOVEDIRS="NO"} # remove empty dirs under ${MNTPREFIX}
: ${USER="0"} # which user to use for popup
: ${FM="0"} # which file manager to use
@ -140,6 +156,7 @@ case ${2} in
MNT="${MNTPREFIX}/${1}"
__check_already_mounted ${MNT}
__create_mount_point ${DEV}
[ "${ATIME}" = NO ] && OPTS="noatime"
case $( file -b -L -s ${DEV} | sed -E 's/label:\ \".*\"//g' ) in
(*FAT*) # must be before NTFS section: newfs_msdos -O NTFS -L NTFS
dd < ${DEV} count=1 2> /dev/null | strings | grep "FAT32" && {
@ -152,7 +169,7 @@ case ${2} in
(*NTFS*) # must be after FAT section: newfs_msdos -O NTFS -L NTFS
dd < ${DEV} count=1 2> /dev/null | strings | head -1 | grep "NTFS" && {
which ntfs-3g 1> /dev/null 2> /dev/null && {
ntfs-3g -o noatime ${DEV} ${MNT} && ADD=1 # sysutils/fusefs-ntfs
ntfs-3g -o ${OPTS} ${DEV} ${MNT} && ADD=1 # sysutils/fusefs-ntfs
} || {
[ "${USER}" = 0 ] || OPTS="-u ${USER} -g $( id -g -n ${USER} )"
mount_ntfs ${OPTS} -o noatime ${DEV} ${MNT} && ADD=1
@ -162,12 +179,12 @@ case ${2} in
;;
(*ext2*)
fsck.ext2 -y ${DEV}
mount -t ext2fs -o noatime ${DEV} ${MNT} && ADD=1
mount -t ext2fs -o ${OPTS} ${DEV} ${MNT} && ADD=1
__log "${DEV}:mount (ext2)"
;;
(*ext3*)
fsck.ext3 -y ${DEV}
mount -t ext2fs -o noatime ${DEV} ${MNT} && ADD=1
mount -t ext2fs -o ${OPTS} ${DEV} ${MNT} && ADD=1
__log "${DEV}:mount (ext3)"
;;
(*ext4*)
@ -177,13 +194,13 @@ case ${2} in
;;
(*Unix\ Fast\ File*)
fsck_ufs -C -y ${DEV}
mount -o noatime ${DEV} ${MNT} && ADD=1
mount -o ${OPTS} ${DEV} ${MNT} && ADD=1
__log "${DEV}:mount (ufs)"
;;
(*)
case $( dd < ${DEV} count=1 2> /dev/null | strings | head -1 ) in
(EXFAT)
mount.exfat -o noatime ${DEV} ${MNT} && ADD=1 # sysutils/fusefs-exfat
mount.exfat -o ${OPTS} ${DEV} ${MNT} && ADD=1 # sysutils/fusefs-exfat
__log "${DEV}:mount (exfat)"
;;
esac
@ -210,7 +227,7 @@ case ${2} in
__log "${DEV}:umount"
done
__log "${DEV}:detach"
find ${MNTPREFIX} -type d -empty -maxdepth 1 -delete
[ "${REMOVEDIRS}" = YES ] && find ${MNTPREFIX} -type d -empty -maxdepth 1 -delete
;;
esac

View File

@ -1,4 +1,6 @@
USERUMOUNT=YES
ATIME=NO
REMOVEDIRS=YES
FM="nautilus --browser --no-desktop"
USER=vermaden
ENCODING=pl_PL.ISO8859-2

Binary file not shown.

View File

@ -83,6 +83,20 @@ USERUMOUNT (set to NO by default)
system with their selected file manager.
example: USERUMOUNT="YES"
ATIME (set to YES by default)
When set to NO it will mount filesystems with
noatime options when possible.
example: ATIME="NO"
REMOVEDIRS (set to NO by default)
When set to YES it will remove empty directories
under the used ${MNTPREFIX} after device detach.
example: REMOVEDIRS="YES"
EOF
exit 0
}
@ -98,6 +112,8 @@ EOF
: ${CODEPAGE="cp437"} # US/Canada
: ${DATEFMT="%Y-%m-%d %H:%M:%S"} # 2012-02-20 07:49:09
: ${USERUMOUNT="NO"} # when YES add suid bit to umount(8)
: ${ATIME="YES"} # when NO mount with noatime
: ${REMOVEDIRS="NO"} # remove empty dirs under ${MNTPREFIX}
: ${USER="0"} # which user to use for popup
: ${FM="0"} # which file manager to use
@ -140,6 +156,7 @@ case ${2} in
MNT="${MNTPREFIX}/${1}"
__check_already_mounted ${MNT}
__create_mount_point ${DEV}
[ "${ATIME}" = NO ] && OPTS="noatime"
case $( file -b -L -s ${DEV} | sed -E 's/label:\ \".*\"//g' ) in
(*FAT*) # must be before NTFS section: newfs_msdos -O NTFS -L NTFS
dd < ${DEV} count=1 2> /dev/null | strings | grep "FAT32" && {
@ -152,7 +169,7 @@ case ${2} in
(*NTFS*) # must be after FAT section: newfs_msdos -O NTFS -L NTFS
dd < ${DEV} count=1 2> /dev/null | strings | head -1 | grep "NTFS" && {
which ntfs-3g 1> /dev/null 2> /dev/null && {
ntfs-3g -o noatime ${DEV} ${MNT} && ADD=1 # sysutils/fusefs-ntfs
ntfs-3g -o ${OPTS} ${DEV} ${MNT} && ADD=1 # sysutils/fusefs-ntfs
} || {
[ "${USER}" = 0 ] || OPTS="-u ${USER} -g $( id -g -n ${USER} )"
mount_ntfs ${OPTS} -o noatime ${DEV} ${MNT} && ADD=1
@ -162,12 +179,12 @@ case ${2} in
;;
(*ext2*)
fsck.ext2 -y ${DEV}
mount -t ext2fs -o noatime ${DEV} ${MNT} && ADD=1
mount -t ext2fs -o ${OPTS} ${DEV} ${MNT} && ADD=1
__log "${DEV}:mount (ext2)"
;;
(*ext3*)
fsck.ext3 -y ${DEV}
mount -t ext2fs -o noatime ${DEV} ${MNT} && ADD=1
mount -t ext2fs -o ${OPTS} ${DEV} ${MNT} && ADD=1
__log "${DEV}:mount (ext3)"
;;
(*ext4*)
@ -177,13 +194,13 @@ case ${2} in
;;
(*Unix\ Fast\ File*)
fsck_ufs -C -y ${DEV}
mount -o noatime ${DEV} ${MNT} && ADD=1
mount -o ${OPTS} ${DEV} ${MNT} && ADD=1
__log "${DEV}:mount (ufs)"
;;
(*)
case $( dd < ${DEV} count=1 2> /dev/null | strings | head -1 ) in
(EXFAT)
mount.exfat -o noatime ${DEV} ${MNT} && ADD=1 # sysutils/fusefs-exfat
mount.exfat -o ${OPTS} ${DEV} ${MNT} && ADD=1 # sysutils/fusefs-exfat
__log "${DEV}:mount (exfat)"
;;
esac
@ -210,7 +227,7 @@ case ${2} in
__log "${DEV}:umount"
done
__log "${DEV}:detach"
find ${MNTPREFIX} -type d -empty -maxdepth 1 -delete
[ "${REMOVEDIRS}" = YES ] && find ${MNTPREFIX} -type d -empty -maxdepth 1 -delete
;;
esac

View File

@ -0,0 +1,7 @@
USERUMOUNT=YES
ATIME=NO
REMOVEDIRS=YES
FM="nautilus --browser --no-desktop"
USER=vermaden
ENCODING=pl_PL.ISO8859-2
CODEPAGE=cp852

View File

@ -1,2 +1,2 @@
SHA256 (automount-1.0.tar.gz) = 8d01d7c5fd6296f5c05a43ffb23726ef85828185864e6f1a970b50dc3b5f073f
SIZE (automount-1.0.tar.gz) = 3256
SHA256 (automount-1.0.tar.gz) = 0cf4d5f306d9ca104a3a977fe630a499048e7d226bf980f86afd9e0c111b1b5f
SIZE (automount-1.0.tar.gz) = 3447