1.3.1
This commit is contained in:
parent
1cf0ecda5c
commit
9d275e6e88
189
README
189
README
|
|
@ -1,101 +1,27 @@
|
||||||
AUTOMOUNT is a devd(8) based flexible yet very simple automounter for FreeBSD.
|
VERSION 1.3.1
|
||||||
|
|
||||||
Currently it supports these file systems:
|
Fixed the 'detach' section (s/PREFIX/MNTPREFIX/g).
|
||||||
-- NTFS requires sysutils/fusefs-ntfs for R/W
|
Fixed removing directories of manually (properly) unmounted filesystems.
|
||||||
-- FAT/FAT32
|
|
||||||
-- exFAT requires sysutils/fusefs-exfat
|
|
||||||
-- EXT2
|
|
||||||
-- EXT3
|
|
||||||
-- EXT4 requires sysutils/fusefs-ext4fuse
|
|
||||||
-- UFS
|
|
||||||
|
|
||||||
It keeps state of the mounted devices at /var/run/automount.state and logs
|
|
||||||
all activities to /var/log/automount.log file.
|
|
||||||
|
|
||||||
The place for the script is at /usr/local/sbin/automount.sh executable.
|
|
||||||
|
|
||||||
The only additional configuration it requires is to add these lines as
|
|
||||||
/usr/local/etc/devd/automount_devd.conf file, which would allow it to work.
|
|
||||||
|
|
||||||
Remember to restart /etc/rc.d/devd daemon after adding
|
|
||||||
/usr/local/etc/devd/automount_devd.conf file.
|
|
||||||
|
|
||||||
INSTALL:
|
|
||||||
|
|
||||||
# cp automount.sh /usr/local/sbin/automount.sh
|
|
||||||
# cp automount.conf /usr/local/etc/automount.conf
|
|
||||||
# cp automount_devd.conf /usr/local/etc/devd/automount_devd.conf
|
|
||||||
# /etc/rc.d/devd restart
|
|
||||||
|
|
||||||
Now plugin Your USB thumb drive ;)
|
|
||||||
|
|
||||||
Have Fun ;)
|
|
||||||
vermaden
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
|
||||||
Latest changes ...
|
VERSION 1.3
|
||||||
|
|
||||||
I removed the state_lock and stat_unlock mechanisms as they appeared to be not
|
Fixed inproper exFAT detection, now mounts fine.
|
||||||
needed, I have shufled with 3 drives all the time and the 'integrity' has not
|
Fixed creating mount dirs for attached devices no matter if needed or not.
|
||||||
been lost, at it was a lot faster, because the lock always had to wait for the
|
Revised 'detach' section, now removes only directory that is unmounted.
|
||||||
'slowest' drive (in term of initializing the device, like USB hard drive).
|
Simplified FAT/NTFS sections, removed additional checks as they break
|
||||||
|
some MP3 players automount.
|
||||||
I simplified the 'attach' section a lot, now each filesystem contains only
|
|
||||||
check/fsck (if possible), mount and log info.
|
|
||||||
|
|
||||||
I also simplified and improved the 'detach' section a little.
|
|
||||||
|
|
||||||
I added an option to automatically launch the set-up in config file manager.
|
|
||||||
|
|
||||||
These are options that I currently successfully use for NAUTILUS file manager,
|
|
||||||
You need to set-up all three of them to make it work.
|
|
||||||
|
|
||||||
| POPUP=YES
|
|
||||||
| FM="nautilus --browser --no-desktop"
|
|
||||||
| USER=vermaden
|
|
||||||
|
|
||||||
My whole config looks like that now:
|
|
||||||
|
|
||||||
| USERUMOUNT=YES
|
|
||||||
| POPUP=YES
|
|
||||||
| FM="nautilus --browser --no-desktop"
|
|
||||||
| USER=vermaden
|
|
||||||
| ENCODING=pl_PL.ISO8859-2
|
|
||||||
| CODEPAGE=cp852
|
|
||||||
|
|
||||||
All latest updates are available at GITHUB repository:
|
|
||||||
https://github.com/vermaden/automount
|
|
||||||
|
|
||||||
Regards,
|
|
||||||
vermaden
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
|
||||||
Latest changes ...
|
VERSION 1.2.1
|
||||||
|
|
||||||
FAT/NTFS detection improvements.
|
Added the --help page.
|
||||||
The 'chown' now uses sets user's group.
|
Removed some small bugs.
|
||||||
MSDOS filesystem is now mounted with -m 644 -M 755 options by default.
|
Added more options to configure features.
|
||||||
Removed POPUP=YES option, just use USER + FM for simplicity.
|
|
||||||
NTFS filesystem, when mounted by mount_ntfs(8) uses -u and -g options by default.
|
|
||||||
Even more simplified 'detach' section.
|
|
||||||
|
|
||||||
Regards,
|
|
||||||
vermaden
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Latest changes ...
|
|
||||||
|
|
||||||
Added PORT ;)
|
|
||||||
|
|
||||||
Regards,
|
|
||||||
vermaden
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Added the --help page, removed some bugs, added options to configure features.
|
|
||||||
|
|
||||||
% automount --help
|
% automount --help
|
||||||
AUTOMOUNT is a devd(8) based automounter for FreeBSD.
|
AUTOMOUNT is a devd(8) based automounter for FreeBSD.
|
||||||
|
|
@ -168,17 +94,88 @@ REMOVEDIRS (set to NO by default)
|
||||||
|
|
||||||
example: REMOVEDIRS="YES"
|
example: REMOVEDIRS="YES"
|
||||||
|
|
||||||
Regards,
|
|
||||||
vermaden
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
|
||||||
Fixed bug about inproper exFAT detection, now mounts fine.
|
VERSION 1.2
|
||||||
Fixed bug about creating mount dirs for all attached devices no matter if needed or not.
|
|
||||||
Revised 'detach' section, now removes only directory that is unmounted (if enabled of course).
|
|
||||||
Simplified FAT/NTFS sections, removed additional check as it break some MP3 players default filesystems automount.
|
|
||||||
|
|
||||||
Regards,
|
FAT/NTFS detection improvements.
|
||||||
|
The 'chown' now uses sets user's group.
|
||||||
|
MSDOS filesystem is now mounted with -m 644 -M 755 options by default.
|
||||||
|
Removed POPUP=YES option, just use USER + FM for simplicity.
|
||||||
|
NTFS filesystem, when mounted by mount_ntfs(8) uses -u and -g options.
|
||||||
|
Even more simplified 'detach' section.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
VERSION 1.1
|
||||||
|
|
||||||
|
I removed the state_lock and stat_unlock mechanisms as they appeared to be
|
||||||
|
not needed, I have shufled with 3 drives all the time and the 'integrity'
|
||||||
|
has not been lost, at it was a lot faster, because the lock always had to
|
||||||
|
wait for the 'slowest' drive (in term of initializing the device, like USB
|
||||||
|
hard drive).
|
||||||
|
|
||||||
|
I simplified the 'attach' section a lot, now each filesystem contains only
|
||||||
|
check/fsck (if possible), mount and log info.
|
||||||
|
|
||||||
|
I also simplified and improved the 'detach' section a little.
|
||||||
|
|
||||||
|
I added an option to automatically launch the set-up in config file manager.
|
||||||
|
|
||||||
|
These are options that I currently successfully use for NAUTILUS file
|
||||||
|
manager. You need to set-up all three of them to make it work.
|
||||||
|
|
||||||
|
| POPUP=YES
|
||||||
|
| FM="nautilus --browser --no-desktop"
|
||||||
|
| USER=vermaden
|
||||||
|
|
||||||
|
My whole config looks like that now:
|
||||||
|
|
||||||
|
| USERUMOUNT=YES
|
||||||
|
| POPUP=YES
|
||||||
|
| FM="nautilus --browser --no-desktop"
|
||||||
|
| USER=vermaden
|
||||||
|
| ENCODING=pl_PL.ISO8859-2
|
||||||
|
| CODEPAGE=cp852
|
||||||
|
|
||||||
|
All latest updates are available at GITHUB repository:
|
||||||
|
https://github.com/vermaden/automount
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
VERSION 1.0
|
||||||
|
|
||||||
|
AUTOMOUNT is devd(8) based flexible yet very simple automounter for FreeBSD.
|
||||||
|
|
||||||
|
Currently it supports these file systems:
|
||||||
|
-- NTFS requires sysutils/fusefs-ntfs for R/W
|
||||||
|
-- FAT/FAT32
|
||||||
|
-- exFAT requires sysutils/fusefs-exfat
|
||||||
|
-- EXT2
|
||||||
|
-- EXT3
|
||||||
|
-- EXT4 requires sysutils/fusefs-ext4fuse
|
||||||
|
-- UFS
|
||||||
|
|
||||||
|
It keeps state of the mounted devices at /var/run/automount.state and logs
|
||||||
|
all activities to /var/log/automount.log file.
|
||||||
|
|
||||||
|
The place for the script is at /usr/local/sbin/automount.sh executable.
|
||||||
|
|
||||||
|
The only additional configuration it requires is to add these lines as
|
||||||
|
/usr/local/etc/devd/automount_devd.conf file, which would allow it to work.
|
||||||
|
|
||||||
|
Remember to restart /etc/rc.d/devd daemon after adding
|
||||||
|
/usr/local/etc/devd/automount_devd.conf file.
|
||||||
|
|
||||||
|
INSTALL:
|
||||||
|
|
||||||
|
# cp automount.sh /usr/local/sbin/automount.sh
|
||||||
|
# cp automount.conf /usr/local/etc/automount.conf
|
||||||
|
# cp automount_devd.conf /usr/local/etc/devd/automount_devd.conf
|
||||||
|
# /etc/rc.d/devd restart
|
||||||
|
|
||||||
|
Now plugin Your USB thumb drive ;)
|
||||||
|
|
||||||
|
Have Fun ;)
|
||||||
vermaden
|
vermaden
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
16
automount
16
automount
|
|
@ -143,6 +143,11 @@ __state_remove() { # 1=MNT
|
||||||
sed -i '' "/${BSMNT}\$/d" ${STATE}
|
sed -i '' "/${BSMNT}\$/d" ${STATE}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__remove_dir() { # 1=TARGET
|
||||||
|
[ "${REMOVEDIRS}" = YES ] \
|
||||||
|
&& find "${1}" -type d -empty -maxdepth 1 -exec rm -r {} '+'
|
||||||
|
}
|
||||||
|
|
||||||
__log() { # @=MESSAGE
|
__log() { # @=MESSAGE
|
||||||
echo $( date +"${DATEFMT}" ) ${@} >> ${LOG}
|
echo $( date +"${DATEFMT}" ) ${@} >> ${LOG}
|
||||||
}
|
}
|
||||||
|
|
@ -217,20 +222,23 @@ case ${2} in
|
||||||
;;
|
;;
|
||||||
|
|
||||||
(detach)
|
(detach)
|
||||||
grep -E "${PREFIX}/${1}$" ${STATE} \
|
grep -E "${MNTPREFIX}/${1}$" ${STATE} \
|
||||||
| while read DEV PROVIDER MNT
|
| while read DEV PROVIDER MNT
|
||||||
do
|
do
|
||||||
TARGET=$( mount | grep -E "^${PROVIDER} " | awk '{print $3}' )
|
TARGET=$( mount | grep -E "^${PROVIDER} " | awk '{print $3}' )
|
||||||
__state_remove ${MNT}
|
__state_remove ${MNT}
|
||||||
[ -z ${TARGET} ] && continue
|
[ -z ${TARGET} ] && continue
|
||||||
( # put entire umount and find/rm block into background
|
( # put entire umount and find/rm block into background
|
||||||
umount -f ${TARGET}
|
umount -f ${TARGET}
|
||||||
[ "${REMOVEDIRS}" = YES ] && find ${TARGET} -type d -empty -maxdepth 1 -exec rm -r {} '+'
|
__remove_dir "${TARGET}"
|
||||||
) &
|
__log "${DEV}:removed '${TARGET}'"
|
||||||
|
) &
|
||||||
unset TARGET
|
unset TARGET
|
||||||
__log "${DEV}:umount"
|
__log "${DEV}:umount"
|
||||||
done
|
done
|
||||||
__log "${DEV}:detach"
|
__log "${DEV}:detach"
|
||||||
|
__remove_dir "${MNTPREFIX}/${1}"
|
||||||
|
__log "${DEV}:removed '${MNTPREFIX}/${1}'"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
esac
|
esac
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -0,0 +1,244 @@
|
||||||
|
#! /bin/sh -x
|
||||||
|
|
||||||
|
# Copyright (c) 2012 Slawomir Wojciech Wojtczak (vermaden)
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that following conditions are met:
|
||||||
|
# 1. Redistributions of source code must retain the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer.
|
||||||
|
# 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer in the
|
||||||
|
# documentation and/or other materials provided with the distribution.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS 'AS IS' AND ANY
|
||||||
|
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
# DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
|
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
PATH=${PATH}:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
|
||||||
|
|
||||||
|
__usage() {
|
||||||
|
cat << EOF
|
||||||
|
AUTOMOUNT is a devd(8) based automounter for FreeBSD.
|
||||||
|
|
||||||
|
It supports following file systems:
|
||||||
|
UFS/FAT/exFAT/NTFS/EXT2/EXT3/EXT4
|
||||||
|
|
||||||
|
It needs these ports to mount NTFS/exFAT/EXT4 respectively:
|
||||||
|
o sysutils/fusefs-ntfs
|
||||||
|
o sysutils/fusefs-exfat
|
||||||
|
o sysutils/fusefs-ext4fuse
|
||||||
|
|
||||||
|
By default it mounts/unmounts all removable media but
|
||||||
|
it is possible to set some additional options at the
|
||||||
|
/usr/local/etc/automount.conf config file.
|
||||||
|
|
||||||
|
Below is a list of possible options with description.
|
||||||
|
|
||||||
|
MNTPREFIX (set to /media by default)
|
||||||
|
With this options You can alter the default root
|
||||||
|
for mounting the removable media, for example to
|
||||||
|
the /mnt directory.
|
||||||
|
|
||||||
|
example: MNTPREFIX="/media"
|
||||||
|
|
||||||
|
ENCODING (set to en_US.ISO8859-1 by default)
|
||||||
|
Only used with FAT32 mounts, specifies which
|
||||||
|
encoding to use at the mount.
|
||||||
|
|
||||||
|
example: ENCODING="pl_PL.ISO8859-2"
|
||||||
|
|
||||||
|
CODEPAGE (set to cp437 by default)
|
||||||
|
Only used with FAT32 mounts, specifies which
|
||||||
|
code page to use at the mount.
|
||||||
|
|
||||||
|
example: CODEPAGE="cp852"
|
||||||
|
|
||||||
|
USER (unset by default)
|
||||||
|
If set to some username, the mount command will
|
||||||
|
chown(1) the mount directory with the user and
|
||||||
|
its primary user group. If used with FM option
|
||||||
|
allows to launch the specified file manager after
|
||||||
|
a successful mount.
|
||||||
|
|
||||||
|
example: USER="vermaden"
|
||||||
|
|
||||||
|
FM (unset by default)
|
||||||
|
If set to file manager command, the mount will
|
||||||
|
launch the specified command after successful
|
||||||
|
mount. Works only if USER parameter is also set.
|
||||||
|
|
||||||
|
example: FM="nautilus --browser --no-desktop"
|
||||||
|
|
||||||
|
USERUMOUNT (set to NO by default)
|
||||||
|
When set to YES it will 'chmod +s /sbin/umount'
|
||||||
|
which would allow an USER to unmount the file
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
[ "${1}" = "-h" -o "${1}" = "--help" -o ${#} -eq 0 -o ${#} -eq 1 ] && __usage
|
||||||
|
|
||||||
|
[ -f /usr/local/etc/automount.conf ] && . /usr/local/etc/automount.conf
|
||||||
|
|
||||||
|
: ${MNTPREFIX="/media"} # mount prefix
|
||||||
|
: ${LOG="/var/log/automount.log"} # log file
|
||||||
|
: ${STATE="/var/run/automount.state"} # current state file
|
||||||
|
: ${ENCODING="en_US.ISO8859-1"} # US/Canada
|
||||||
|
: ${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
|
||||||
|
|
||||||
|
[ "${USERUMOUNT}" = YES ] && chmod u+s /sbin/umount # WHEEL group member
|
||||||
|
|
||||||
|
__create_mount_point() { # 1=DEV
|
||||||
|
mkdir -p ${MNT}
|
||||||
|
[ "${USER}" = 0 ] || chown ${USER}:$( id -g -n ${USER} ) ${MNT}
|
||||||
|
}
|
||||||
|
|
||||||
|
__check_already_mounted() { # 1=MNT
|
||||||
|
mount | grep " ${1} " 1> /dev/null 2> /dev/null && {
|
||||||
|
__log "${DEV}:already mounted (ntfs)"
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
__state_add() { # 1=DEV 2=PROVIDER 3=MNT
|
||||||
|
grep -E "${3}$" ${STATE} 1> /dev/null 2> /dev/null && {
|
||||||
|
__log "${1}:duplicated '${STATE}'"
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
echo "${1} ${2} ${3}" >> ${STATE}
|
||||||
|
}
|
||||||
|
|
||||||
|
__state_remove() { # 1=MNT
|
||||||
|
BSMNT=$( echo ${1} | sed 's/\//\\\//g' ) # backslash the slashes ;)
|
||||||
|
sed -i '' "/${BSMNT}\$/d" ${STATE}
|
||||||
|
}
|
||||||
|
|
||||||
|
__remove_dir() { # 1=TARGET
|
||||||
|
[ "${REMOVEDIRS}" = YES ] \
|
||||||
|
&& find "${1}" -type d -empty -maxdepth 1 -exec rm -r {} '+'
|
||||||
|
}
|
||||||
|
|
||||||
|
__log() { # @=MESSAGE
|
||||||
|
echo $( date +"${DATEFMT}" ) ${@} >> ${LOG}
|
||||||
|
}
|
||||||
|
|
||||||
|
DEV=/dev/${1}
|
||||||
|
|
||||||
|
case ${2} in
|
||||||
|
(attach)
|
||||||
|
ADD=0
|
||||||
|
MNT="${MNTPREFIX}/${1}"
|
||||||
|
__check_already_mounted ${MNT}
|
||||||
|
[ "${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
|
||||||
|
__create_mount_point ${DEV}
|
||||||
|
fsck_msdosfs -y ${DEV}
|
||||||
|
mount_msdosfs -o large -D ${CODEPAGE} -L ${ENCODING} \
|
||||||
|
-m 644 -M 755 ${DEV} ${MNT} && ADD=1
|
||||||
|
__log "${DEV}:mount (fat)"
|
||||||
|
;;
|
||||||
|
(*NTFS*) # must be after FAT section: newfs_msdos -O NTFS -L NTFS
|
||||||
|
__create_mount_point ${DEV}
|
||||||
|
which ntfs-3g 1> /dev/null 2> /dev/null && {
|
||||||
|
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
|
||||||
|
}
|
||||||
|
__log "${DEV}:mount (ntfs)"
|
||||||
|
;;
|
||||||
|
(*ext2*)
|
||||||
|
__create_mount_point ${DEV}
|
||||||
|
fsck.ext2 -y ${DEV}
|
||||||
|
mount -t ext2fs -o ${OPTS} ${DEV} ${MNT} && ADD=1
|
||||||
|
__log "${DEV}:mount (ext2)"
|
||||||
|
;;
|
||||||
|
(*ext3*)
|
||||||
|
__create_mount_point ${DEV}
|
||||||
|
fsck.ext3 -y ${DEV}
|
||||||
|
mount -t ext2fs -o ${OPTS} ${DEV} ${MNT} && ADD=1
|
||||||
|
__log "${DEV}:mount (ext3)"
|
||||||
|
;;
|
||||||
|
(*ext4*)
|
||||||
|
__create_mount_point ${DEV}
|
||||||
|
fsck.ext4 -y ${DEV}
|
||||||
|
ext4fuse ${DEV} ${MNT} && ADD=1 # sysutils/fusefs-ext4fuse
|
||||||
|
__log "${DEV}:mount (ext4)"
|
||||||
|
;;
|
||||||
|
(*Unix\ Fast\ File*)
|
||||||
|
__create_mount_point ${DEV}
|
||||||
|
fsck_ufs -C -y ${DEV}
|
||||||
|
mount -o ${OPTS} ${DEV} ${MNT} && ADD=1
|
||||||
|
__log "${DEV}:mount (ufs)"
|
||||||
|
;;
|
||||||
|
(*)
|
||||||
|
case $( dd < ${DEV} count=1 2> /dev/null | strings | head -1 ) in
|
||||||
|
(*EXFAT*)
|
||||||
|
__create_mount_point ${DEV}
|
||||||
|
mount.exfat -o ${OPTS} ${DEV} ${MNT} && ADD=1 # sysutils/fusefs-exfat
|
||||||
|
__log "${DEV}:mount (exfat)"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
[ ${ADD} -eq 1 ] && {
|
||||||
|
ADD=0
|
||||||
|
PROVIDER=$( mount | grep -m 1 " ${MNT} " | awk '{printf $1}' )
|
||||||
|
__state_add ${DEV} ${PROVIDER} ${MNT}
|
||||||
|
[ "${USER}" != 0 ] && [ "${FM}" != 0 ] \
|
||||||
|
&& su - ${USER} -c "env DISPLAY=:0 ${FM} ${MNT} &"
|
||||||
|
}
|
||||||
|
;;
|
||||||
|
|
||||||
|
(detach)
|
||||||
|
grep -E "${MNTPREFIX}/${1}$" ${STATE} \
|
||||||
|
| while read DEV PROVIDER MNT
|
||||||
|
do
|
||||||
|
TARGET=$( mount | grep -E "^${PROVIDER} " | awk '{print $3}' )
|
||||||
|
__state_remove ${MNT}
|
||||||
|
[ -z ${TARGET} ] && continue
|
||||||
|
( # put entire umount and find/rm block into background
|
||||||
|
umount -f ${TARGET}
|
||||||
|
__remove_dir "${TARGET}"
|
||||||
|
__log "${DEV}:removed '${TARGET}'"
|
||||||
|
) &
|
||||||
|
unset TARGET
|
||||||
|
__log "${DEV}:umount"
|
||||||
|
done
|
||||||
|
__log "${DEV}:detach"
|
||||||
|
__remove_dir "${MNTPREFIX}/${1}"
|
||||||
|
__log "${DEV}:removed '${MNTPREFIX}/${1}'"
|
||||||
|
;;
|
||||||
|
|
||||||
|
esac
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
USERUMOUNT=YES
|
||||||
|
ATIME=NO
|
||||||
|
REMOVEDIRS=YES
|
||||||
|
FM="nautilus --browser --no-desktop"
|
||||||
|
USER=vermaden
|
||||||
|
ENCODING=pl_PL.ISO8859-2
|
||||||
|
CODEPAGE=cp852
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
USERUMOUNT=YES
|
||||||
|
FM="nautilus --browser --no-desktop"
|
||||||
|
USER=vermaden
|
||||||
|
ENCODING=pl_PL.ISO8859-2
|
||||||
|
CODEPAGE=cp852
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
notify 100 {
|
||||||
|
match "system" "DEVFS";
|
||||||
|
match "type" "CREATE";
|
||||||
|
match "cdev" "(da|mmcsd)[0-9]+";
|
||||||
|
action "/usr/local/sbin/automount $cdev attach";
|
||||||
|
};
|
||||||
|
|
||||||
|
notify 100 {
|
||||||
|
match "system" "DEVFS";
|
||||||
|
match "type" "DESTROY";
|
||||||
|
match "cdev" "(da|mmcsd)[0-9]+";
|
||||||
|
action "/usr/local/sbin/automount $cdev detach";
|
||||||
|
};
|
||||||
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
PORTNAME= automount
|
PORTNAME= automount
|
||||||
PORTVERSION= 1.3
|
PORTVERSION= 1.3.1
|
||||||
CATEGORIES= sysutils
|
CATEGORIES= sysutils
|
||||||
MASTER_SITES= https://github.com/vermaden/automount/port/distfiles/
|
MASTER_SITES= https://github.com/vermaden/automount/port/distfiles/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,2 @@
|
||||||
SHA256 (automount-1.3.tar.gz) = 50f403681725f8bc59f35190c520dbce9c965608a8d61a46bcbef52f28d58d72
|
SHA256 (automount-1.3.1.tar.gz) = 3f37c223d33d6e830f693d3ff57a516d14dbd32a0ee854beb1e2a1d848528663
|
||||||
SIZE (automount-1.3.tar.gz) = 3492
|
SIZE (automount-1.3.1.tar.gz) = 3532
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue