diff --git a/automount b/automount index 1f22a38..70761a6 100755 --- a/automount +++ b/automount @@ -125,6 +125,15 @@ BLACKLIST (unset by default) example: BLACKLIST='da0 da3s1a' + +BLACKLIST_REGEX (unset by default) + The boolean flag option complements the above BLACKLIST option + if one wants regex match instead of exact match for ignoring devices. + Below will ignore all partitions ada0p1/ada0p2/... of ada0 device. + + example: BLACKLIST='ada0' + BLACKLIST_REGEX=true + USER (root by default) If set to some username, the mount command will chown(1) the mount directory with the user and @@ -259,11 +268,12 @@ __guess_fs_type() { # 1=DEV # second time guess with file(1) tool with -k option # (do not stop at the first match and keep going) unset FS_TYPE - local FS_TYPE=$( file -k -r -b -L -s ${1} 2> /dev/null | sed -E 's/label:\ \".*\"//g' ) + local FS_TYPE=$( file -k -r -b -L -s ${1} 2> /dev/null | tr '\n' ' ' | sed -E 's/label:\ \".*\"//g' ) case ${FS_TYPE} in - (*Unix\ Fast\ File*) return ${FS_TYPE_UFS} ;; - (*NTFS*) return ${FS_TYPE_NTFS} ;; - (*\ FAT\ *|*MSDOS*) return ${FS_TYPE_FAT} ;; + (*Unix\ Fast\ File*) return ${FS_TYPE_UFS} ;; + (*NTFS*) return ${FS_TYPE_NTFS} ;; + (*ExFAT*) return ${FS_TYPE_EXFAT} ;; + (*\ FAT\ *|*MSDOS*) return ${FS_TYPE_FAT} ;; esac # try with fstyp(8) last (exFAT on UFS issue) unset FS_TYPE @@ -336,7 +346,8 @@ __remove_dir() { # 1=TARGET if [ -d "${1}" ] then sleep 1 - find "${1}" -type d -empty -maxdepth 1 -exec rm -r {} '+' 2> /dev/null + # find "${1}" -type d -empty -maxdepth 1 -exec rm -r {} '+' 2> /dev/null + find "${MNT_PREFIX}" -depth 1 -empty -prune -delete 2> /dev/null fi fi } @@ -479,6 +490,10 @@ case ${2} in then __log "${DEV}: device blocked by BLACKLIST option" exit 0 + elif [ -n "${BLACKLIST_REGEX}" ] && echo ${DEV} | grep -q "${I}" 1> /dev/null 2> /dev/null + then + __log "${DEV}: device blocked by BLACKLIST_REGEX option" + exit 0 fi done fi @@ -536,15 +551,17 @@ case ${2} in FS_CHECK_PORT='sysutils/e2fsprogs' FS_CHECK_CMD='fsck.ext2' FS_CHECK_ARGS="-y" - FS_MOUNT_CMD='mount' - FS_MOUNT_ARGS="-t ext2fs ${OPTS} ${DEV} ${MNT}" + FS_MOUNT_PORT='sysutils/fusefs-lkl' + FS_MOUNT_CMD='lklfuse' + FS_MOUNT_ARGS="-o type=ext2 -o allow_other -o intr -o uid=${UID} -o gid=${GID} -o umask=002 ${DEV} ${MNT}" ;; (${FS_TYPE_EXT3}) FS_CHECK_PORT='sysutils/e2fsprogs' FS_CHECK_CMD='fsck.ext3' FS_CHECK_ARGS="-y" - FS_MOUNT_CMD='mount' - FS_MOUNT_ARGS="-t ext2fs ${OPTS} ${DEV} ${MNT}" + FS_MOUNT_PORT='sysutils/fusefs-lkl' + FS_MOUNT_CMD='lklfuse' + FS_MOUNT_ARGS="-o type=ext3 -o allow_other -o intr -o uid=${UID} -o gid=${GID} -o umask=002 ${DEV} ${MNT}" ;; (${FS_TYPE_EXT4}) FS_CHECK_PORT='sysutils/e2fsprogs'