diff --git a/automount b/automount index 1d69ac5..b4c3ce9 100755 --- a/automount +++ b/automount @@ -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 diff --git a/automount.conf b/automount.conf index a2d89cd..1ba5f6c 100644 --- a/automount.conf +++ b/automount.conf @@ -1,4 +1,6 @@ USERUMOUNT=YES +ATIME=NO +REMOVEDIRS=YES FM="nautilus --browser --no-desktop" USER=vermaden ENCODING=pl_PL.ISO8859-2 diff --git a/port/distfiles/automount-1.0.tar.gz b/port/distfiles/automount-1.0.tar.gz index 6fd0955..b0659a2 100644 Binary files a/port/distfiles/automount-1.0.tar.gz and b/port/distfiles/automount-1.0.tar.gz differ diff --git a/port/distfiles/automount-1.0/automount b/port/distfiles/automount-1.0/automount index 1d69ac5..b4c3ce9 100755 --- a/port/distfiles/automount-1.0/automount +++ b/port/distfiles/automount-1.0/automount @@ -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 diff --git a/port/distfiles/automount-1.0/automount.conf b/port/distfiles/automount-1.0/automount.conf new file mode 100644 index 0000000..1ba5f6c --- /dev/null +++ b/port/distfiles/automount-1.0/automount.conf @@ -0,0 +1,7 @@ +USERUMOUNT=YES +ATIME=NO +REMOVEDIRS=YES +FM="nautilus --browser --no-desktop" +USER=vermaden +ENCODING=pl_PL.ISO8859-2 +CODEPAGE=cp852 diff --git a/port/sysutils/automount/distinfo b/port/sysutils/automount/distinfo index 06ab9cb..e953709 100644 --- a/port/sysutils/automount/distinfo +++ b/port/sysutils/automount/distinfo @@ -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