1.1
This commit is contained in:
parent
5f95b7cf03
commit
ff15d66f2c
75
automount
75
automount
|
|
@ -22,7 +22,72 @@
|
||||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
|
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"
|
||||||
|
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
|
[ -f /usr/local/etc/automount.conf ] && . /usr/local/etc/automount.conf
|
||||||
|
|
||||||
|
|
@ -86,9 +151,6 @@ case ${2} in
|
||||||
;;
|
;;
|
||||||
(*NTFS*) # must be after FAT section: newfs_msdos -O NTFS -L NTFS
|
(*NTFS*) # must be after FAT section: newfs_msdos -O NTFS -L NTFS
|
||||||
dd < ${DEV} count=1 2> /dev/null | strings | head -1 | grep "NTFS" && {
|
dd < ${DEV} count=1 2> /dev/null | strings | head -1 | grep "NTFS" && {
|
||||||
which ntfsfix 1> /dev/null 2> /dev/null && {
|
|
||||||
ntfsfix ${DEV} # sysutils/ntfsprogs
|
|
||||||
}
|
|
||||||
which ntfs-3g 1> /dev/null 2> /dev/null && {
|
which ntfs-3g 1> /dev/null 2> /dev/null && {
|
||||||
ntfs-3g -o noatime ${DEV} ${MNT} && ADD=1 # sysutils/fusefs-ntfs
|
ntfs-3g -o noatime ${DEV} ${MNT} && ADD=1 # sysutils/fusefs-ntfs
|
||||||
} || {
|
} || {
|
||||||
|
|
@ -122,7 +184,7 @@ case ${2} in
|
||||||
case $( dd < ${DEV} count=1 2> /dev/null | strings | head -1 ) in
|
case $( dd < ${DEV} count=1 2> /dev/null | strings | head -1 ) in
|
||||||
(EXFAT)
|
(EXFAT)
|
||||||
mount.exfat -o noatime ${DEV} ${MNT} && ADD=1 # sysutils/fusefs-exfat
|
mount.exfat -o noatime ${DEV} ${MNT} && ADD=1 # sysutils/fusefs-exfat
|
||||||
__log "${DEV}:mount (ufs)"
|
__log "${DEV}:mount (exfat)"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
|
|
@ -148,8 +210,7 @@ case ${2} in
|
||||||
__log "${DEV}:umount"
|
__log "${DEV}:umount"
|
||||||
done
|
done
|
||||||
__log "${DEV}:detach"
|
__log "${DEV}:detach"
|
||||||
|
find ${MNTPREFIX} -type d -empty -maxdepth 1 -delete
|
||||||
;;
|
;;
|
||||||
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
find ${MNTPREFIX} -type d -empty -delete
|
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -22,7 +22,72 @@
|
||||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
|
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"
|
||||||
|
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
|
[ -f /usr/local/etc/automount.conf ] && . /usr/local/etc/automount.conf
|
||||||
|
|
||||||
|
|
@ -86,9 +151,6 @@ case ${2} in
|
||||||
;;
|
;;
|
||||||
(*NTFS*) # must be after FAT section: newfs_msdos -O NTFS -L NTFS
|
(*NTFS*) # must be after FAT section: newfs_msdos -O NTFS -L NTFS
|
||||||
dd < ${DEV} count=1 2> /dev/null | strings | head -1 | grep "NTFS" && {
|
dd < ${DEV} count=1 2> /dev/null | strings | head -1 | grep "NTFS" && {
|
||||||
which ntfsfix 1> /dev/null 2> /dev/null && {
|
|
||||||
ntfsfix ${DEV} # sysutils/ntfsprogs
|
|
||||||
}
|
|
||||||
which ntfs-3g 1> /dev/null 2> /dev/null && {
|
which ntfs-3g 1> /dev/null 2> /dev/null && {
|
||||||
ntfs-3g -o noatime ${DEV} ${MNT} && ADD=1 # sysutils/fusefs-ntfs
|
ntfs-3g -o noatime ${DEV} ${MNT} && ADD=1 # sysutils/fusefs-ntfs
|
||||||
} || {
|
} || {
|
||||||
|
|
@ -122,7 +184,7 @@ case ${2} in
|
||||||
case $( dd < ${DEV} count=1 2> /dev/null | strings | head -1 ) in
|
case $( dd < ${DEV} count=1 2> /dev/null | strings | head -1 ) in
|
||||||
(EXFAT)
|
(EXFAT)
|
||||||
mount.exfat -o noatime ${DEV} ${MNT} && ADD=1 # sysutils/fusefs-exfat
|
mount.exfat -o noatime ${DEV} ${MNT} && ADD=1 # sysutils/fusefs-exfat
|
||||||
__log "${DEV}:mount (ufs)"
|
__log "${DEV}:mount (exfat)"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
|
|
@ -148,8 +210,7 @@ case ${2} in
|
||||||
__log "${DEV}:umount"
|
__log "${DEV}:umount"
|
||||||
done
|
done
|
||||||
__log "${DEV}:detach"
|
__log "${DEV}:detach"
|
||||||
|
find ${MNTPREFIX} -type d -empty -maxdepth 1 -delete
|
||||||
;;
|
;;
|
||||||
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
find ${MNTPREFIX} -type d -empty -delete
|
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
PORTNAME= automount
|
PORTNAME= automount
|
||||||
PORTVERSION= 1.0
|
PORTVERSION= 1.0
|
||||||
|
LICENSE= BSD
|
||||||
CATEGORIES= sysutils
|
CATEGORIES= sysutils
|
||||||
MASTER_SITES= https://github.com/vermaden/automount/
|
MASTER_SITES= https://github.com/vermaden/automount/
|
||||||
|
|
||||||
|
|
@ -15,12 +16,12 @@ COMMENT= devd(8) based automount sollution
|
||||||
|
|
||||||
PLIST_FILES= sbin/automount etc/devd/automount_devd.conf etc/automount.conf.sample
|
PLIST_FILES= sbin/automount etc/devd/automount_devd.conf etc/automount.conf.sample
|
||||||
|
|
||||||
do-build:
|
NO_BUILD= yes
|
||||||
|
|
||||||
do-install:
|
do-install:
|
||||||
${INSTALL_SCRIPT} ${WRKSRC}/automount ${PREFIX}/sbin
|
${INSTALL_SCRIPT} ${WRKSRC}/automount ${PREFIX}/sbin
|
||||||
${INSTALL_DATA} ${WRKSRC}/automount_devd.conf ${PREFIX}/etc/devd/automount_devd.conf
|
${INSTALL_DATA} ${WRKSRC}/automount_devd.conf ${PREFIX}/etc/devd/automount_devd.conf
|
||||||
${INSTALL_DATA} ${WRKSRC}/automount.conf.sample ${PREFIX}/etc/automount.conf.sample
|
${INSTALL_DATA} ${WRKSRC}/automount.conf.sample ${PREFIX}/etc/automount.conf.sample
|
||||||
/etc/rc.d/devd restart
|
${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
|
||||||
|
|
||||||
.include <bsd.port.mk>
|
.include <bsd.port.mk>
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,2 @@
|
||||||
MD5 (automount-1.0.tar.gz) = 050d33273d952436b492eaa9c13bcfb5
|
SHA256 (automount-1.0.tar.gz) = 3ff5c3a251877624da7caf7d0594e85312a4e9c96a22a30fdf34d1fd302b5f4f
|
||||||
SHA256 (automount-1.0.tar.gz) = dcbe2f11742c92ad9c2bc7d7c33b73efb9148cac46507edd505b4a4fa7198253
|
SIZE (automount-1.0.tar.gz) = 3254
|
||||||
SIZE (automount-1.0.tar.gz) = 2553
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
case ${2} in
|
||||||
|
(POST-INSTALL)
|
||||||
|
/etc/rc.d/devd restart
|
||||||
|
echo
|
||||||
|
echo
|
||||||
|
echo "Check /usr/local/sbin/automount --help for available options."
|
||||||
|
echo
|
||||||
|
echo
|
||||||
|
;;
|
||||||
|
(PRE-INSTALL) : ;;
|
||||||
|
esac
|
||||||
|
|
||||||
Loading…
Reference in New Issue