Compare commits

...

7 Commits

3 changed files with 64 additions and 21 deletions

41
README
View File

@ -13,6 +13,7 @@ It supports most popular file systems:
-------------------------------------------------------------------------------
I N S T A L L
===================
@ -31,27 +32,49 @@ Now plugin Your USB thumb drive and have fun ;)
These ports/packages are needed for all filesystems:
* sysutils/exfat-utils // exFAT
* sysutils/e2fsprogs // EXT2/EXT3/EXT4 fsck(8)
* sysutils/xfsprogs // XFS fsck(8)
* sysutils/exfat-utils // exFAT exfatfsck(8)
* sysutils/fusefs-exfat // exFAT
* sysutils/fusefs-ntfs // NTFS (read write support)
* sysutils/fusefs-ext2 // EXT4
* sysutils/fusefs-hfsfuse // HFS
* sysutils/fusefs-lkl // XFS
* sysutils/fusefs-lkl // XFS/EXT2/EXT3/EXT4
* sysutils/fusefs-simple-mtpfs // MTP
Regards,
vermaden
All of the above are available as pkg(8) packages.
Shortcut:
# pkg install -y \
sysutils/e2fsprogs \
sysutils/xfsprogs \
sysutils/exfat-utils \
sysutils/fusefs-exfat \
sysutils/fusefs-ntfs \
sysutils/fusefs-hfsfuse \
sysutils/fusefs-lkl \
sysutils/fusefs-simple-mtpfs
-------------------------------------------------------------------------------
C H A N G E L O G
=========================
-------------------------------------------------------------------------------
VERSION 1.7.8 (CURRENT)
VERSION 1.7.9 (CURRENT)
Fix XORG detection.
Implement proposed BLACKLIST_REGEX option.
Use 'sysutils/fusefs-lkl' for all ext2/ext3/ext4 mounts.
Fix exFAT detection.
Fix small problem with checking the mount state.
Implement better old directory cleanup.
-------------------------------------------------------------------------------
VERSION 1.7.8
Fix harmless gpart(8) rant about ugen(4) devices.
-------------------------------------------------------------------------------
@ -466,6 +489,8 @@ The only additional configuration it requires is to add these lines as
Remember to restart /etc/rc.d/devd daemon after adding
/usr/local/etc/devd/automount_devd.conf file.
------------------------------------------------------------------------------
Have Fun ;)
vermaden

View File

@ -1,6 +1,6 @@
#!/bin/sh
# Copyright (c) 2012-2022 Slawomir Wojciech Wojtczak <vermaden@interia.pl>
# Copyright (c) 2012-2024 Slawomir Wojciech Wojtczak <vermaden@interia.pl>
# Copyright (c) 2019 Rozhuk Ivan <rozhuk.im@gmail.com>
# All rights reserved.
#
@ -35,7 +35,6 @@ UFS/FAT/exFAT/NTFS/EXT2/EXT3/EXT4/MTP/HFS/ISO9660
Add these to mount NTFS/exFAT/EXT4/HFS/XFS/MTP respectively:
o sysutils/fusefs-ntfs
o sysutils/fusefs-exfat
o sysutils/fusefs-ext4fuse
o sysutils/fusefs-hfsfuse
o sysutils/fusefs-lkl
o sysutils/fusefs-simple-mtpfs
@ -125,6 +124,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
@ -167,7 +175,7 @@ then
echo " / / // / // // / // \\\ \ \ \\\ \ \\\ \ \\\ \ \\\ \_ "
echo " \_____\\\____/ \__\\\____//__________\\\__\__\__\\\____/ \_____\\\__\__\\\___\ "
echo
echo "automount 1.7.9 2022/05/24"
echo "automount 1.8.0 2024/03/05"
exit 0
fi
@ -259,11 +267,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 +345,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 +489,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
@ -491,7 +505,6 @@ case ${2} in
# load needed kernel modules
kldload fusefs 1> /dev/null 2> /dev/null
kldload fuse 1> /dev/null 2> /dev/null
kldload geom_uzip 1> /dev/null 2> /dev/null
# detect filesysytem type
@ -536,15 +549,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'
@ -737,6 +752,7 @@ case ${2} in
continue
fi
( # put entire umount/find/rm block into background
# umount(8) two times to make sure its unmounted
umount -f "${TARGET}" 1> /dev/null 2>&1
umount -f "${TARGET}" 1> /dev/null 2>&1
__log "${DEV}: (state) umount '${TARGET}'"
@ -749,6 +765,8 @@ case ${2} in
# code for NICENAMES mounting instead of the /dev/${DEV} default
if [ "${NICENAMES}" != YES ]
then
# umount(8) two times to make sure its unmounted
umount -f "${MNT_PREFIX}/${1}" 1> /dev/null 2>&1
umount -f "${MNT_PREFIX}/${1}" 1> /dev/null 2>&1
__log "${DEV}: (direct) umount '${MNT_PREFIX}/${1}'"
__remove_dir "${MNT_PREFIX}/${1}" &

BIN
automount-1.7.9.tar.gz Normal file

Binary file not shown.