From 8fc7975c6310240a8aaf7dedf420162916eedb3f Mon Sep 17 00:00:00 2001 From: "Slawomir Wojciech Wojtczak (vermaden)" Date: Sat, 3 Mar 2012 21:57:10 +0100 Subject: [PATCH] 1.2.1 --- automount | 2 +- port/distfiles/automount-1.2.1.tar.gz | Bin 0 -> 3455 bytes port/distfiles/automount-1.2.1/automount | 232 ++++++++++++++++++ port/distfiles/automount-1.2.1/automount.conf | 7 + .../automount-1.2.1/automount.conf.sample | 5 + .../automount-1.2.1/automount_devd.conf | 14 ++ port/sysutils/automount.shar | 26 +- port/sysutils/automount/distinfo | 4 +- 8 files changed, 275 insertions(+), 15 deletions(-) create mode 100644 port/distfiles/automount-1.2.1.tar.gz create mode 100755 port/distfiles/automount-1.2.1/automount create mode 100644 port/distfiles/automount-1.2.1/automount.conf create mode 100644 port/distfiles/automount-1.2.1/automount.conf.sample create mode 100644 port/distfiles/automount-1.2.1/automount_devd.conf diff --git a/automount b/automount index 1935056..ed913cd 100755 --- a/automount +++ b/automount @@ -198,7 +198,7 @@ case ${2} in ;; (*) case $( dd < ${DEV} count=1 2> /dev/null | strings | head -1 ) in - (EXFAT) + (*EXFAT*) mount.exfat -o ${OPTS} ${DEV} ${MNT} && ADD=1 # sysutils/fusefs-exfat __log "${DEV}:mount (exfat)" ;; diff --git a/port/distfiles/automount-1.2.1.tar.gz b/port/distfiles/automount-1.2.1.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..00458acb2ec9edce03dca6f12428d9ac2cb0276c GIT binary patch literal 3455 zcmV-_4S@0=iwFQ|g;Gxd1MOOEQ`<-q-p~FOy@D*Ti|`93WS#Za8e0Ta8Jn}@B-C<8 z2}usR$d*qpBy8gUeoxOxvTPviOR~FHr!ET1nwjorp6==Ck!&S#Fb$Gftk(A$d-dv9 zUqEWL+TpI4$Z^h#&d8HUt2L$_%Jk5fYd~Yyo0?4SZL@4L7CKKnG+N#GdW$qJtNa4|S}iXmRF< z!Am%>Y5SHpbwlt%jk_>lu0TTu1G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grmn>kW|&T8UEeZF|i|AnmoU;w!9tA2ghlwlVy!G*Q?Yq+ac{*dOk$ zr9JTo@prBK^x)l)0`Y;D$@q{+(3v8p641HeMElJ2UXN07Ei#hFUnbZJH+&w;B-dk=~ zXpIt5m+8(X9LsL_^~hPjbKY*%M9IJ8T@ohkffg=h_gY5Aj%NFA~qS{-BLot;SXC zgTMc&A2h`8KkCg|^XdKp)f)Bv!-MkoAAg1vo>(CZRDRXdZ1E^4<0F6l(_VY)lD~6l zi+3JnX82pmgX{m2UoVR!@P}55)R!G@6b2!BbxU^+vh={}kb04^3{V4#-@E zPOTW{ZAHGIQAk1gfK&PNWeb-BxZfRVD9DNpHsS>h+m7{dI<+Hb=jWRG{Xf4GT`cho zft0l$J1m2ZHhDP72U{4jKsoU{k@Ymg91YJuH?*{blFOY&^F98#THA zHx3V)`}+;7|609X{{Hh%k+uC_zI7T53olp8x}cO&N-3q3Qc5YMlu}A5rIb=iDW#NB hN-3q3Qc5YMlu}A5rIb=iDdq1h{{?`CgH!-e0075`$`Akm literal 0 HcmV?d00001 diff --git a/port/distfiles/automount-1.2.1/automount b/port/distfiles/automount-1.2.1/automount new file mode 100755 index 0000000..ed913cd --- /dev/null +++ b/port/distfiles/automount-1.2.1/automount @@ -0,0 +1,232 @@ +#! /bin/sh + +# 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} +} + +__log() { # @=MESSAGE + echo $( date +"${DATEFMT}" ) ${@} >> ${LOG} +} + +DEV=/dev/${1} + +case ${2} in + (attach) + ADD=0 + 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" && { + 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 + dd < ${DEV} count=1 2> /dev/null | strings | head -1 | grep "NTFS" && { + 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*) + fsck.ext2 -y ${DEV} + mount -t ext2fs -o ${OPTS} ${DEV} ${MNT} && ADD=1 + __log "${DEV}:mount (ext2)" + ;; + (*ext3*) + fsck.ext3 -y ${DEV} + mount -t ext2fs -o ${OPTS} ${DEV} ${MNT} && ADD=1 + __log "${DEV}:mount (ext3)" + ;; + (*ext4*) + fsck.ext4 -y ${DEV} + ext4fuse ${DEV} ${MNT} && ADD=1 # sysutils/fusefs-ext4fuse + __log "${DEV}:mount (ext4)" + ;; + (*Unix\ Fast\ File*) + 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*) + 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 "${PREFIX}/${1}$" ${STATE} \ + | while read DEV PROVIDER MNT + do + TARGET=$( mount | grep -E "^${PROVIDER} " | awk '{print $3}' ) + __state_remove ${MNT} + [ -z ${TARGET} ] && continue + umount -f ${TARGET} & + unset TARGET + __log "${DEV}:umount" + done + __log "${DEV}:detach" + [ "${REMOVEDIRS}" = YES ] && find ${MNTPREFIX} -type d -empty -maxdepth 1 -delete + ;; + +esac diff --git a/port/distfiles/automount-1.2.1/automount.conf b/port/distfiles/automount-1.2.1/automount.conf new file mode 100644 index 0000000..1ba5f6c --- /dev/null +++ b/port/distfiles/automount-1.2.1/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/distfiles/automount-1.2.1/automount.conf.sample b/port/distfiles/automount-1.2.1/automount.conf.sample new file mode 100644 index 0000000..a2d89cd --- /dev/null +++ b/port/distfiles/automount-1.2.1/automount.conf.sample @@ -0,0 +1,5 @@ +USERUMOUNT=YES +FM="nautilus --browser --no-desktop" +USER=vermaden +ENCODING=pl_PL.ISO8859-2 +CODEPAGE=cp852 diff --git a/port/distfiles/automount-1.2.1/automount_devd.conf b/port/distfiles/automount-1.2.1/automount_devd.conf new file mode 100644 index 0000000..2614c98 --- /dev/null +++ b/port/distfiles/automount-1.2.1/automount_devd.conf @@ -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"; +}; + diff --git a/port/sysutils/automount.shar b/port/sysutils/automount.shar index 245647d..61d876b 100644 --- a/port/sysutils/automount.shar +++ b/port/sysutils/automount.shar @@ -15,9 +15,9 @@ echo c - automount mkdir -p automount > /dev/null 2>&1 echo x - automount/Makefile sed 's/^X//' >automount/Makefile << 'a684d750ccdf9f4d6ffa6a1936b8d432' -X# New ports collection makefile for: automount -X# Date created: 21 Febryaru 2012 -X# Whom: vermaden +X# New ports collection makefile for: automount +X# Date created: 28 February 2012 +X# Whom: vermaden X# X# $FreeBSD$ X# @@ -25,7 +25,7 @@ X XPORTNAME= automount XPORTVERSION= 1.2 XCATEGORIES= sysutils -XMASTER_SITES= https://github.com/vermaden/automount/ +XMASTER_SITES= https://github.com/vermaden/automount/port/distfiles/ X XMAINTAINER= vermaden@interia.pl XCOMMENT= FreeBSD's devd(8) based automount sollution @@ -55,14 +55,16 @@ X#!/bin/sh X Xcase ${2} in X (POST-INSTALL) -X /etc/rc.d/devd restart -X echo -X echo -X echo "Check /usr/local/sbin/automount --help for available options." -X echo -X echo -X ;; -X (PRE-INSTALL) : ;; +X /etc/rc.d/devd restart +X echo +X echo +X echo "Check /usr/local/sbin/automount --help for available options." +X echo +X echo +X ;; +X (PRE-INSTALL) +X : +X ;; Xesac X 251e9ad33f5651c05228156a36207e92 diff --git a/port/sysutils/automount/distinfo b/port/sysutils/automount/distinfo index 8fc047c..8337a25 100644 --- a/port/sysutils/automount/distinfo +++ b/port/sysutils/automount/distinfo @@ -1,2 +1,2 @@ -SHA256 (automount-1.2.tar.gz) = 5cbb556a861e781312705e1696a495ec688f8581e00e9563d111670699024d5a -SIZE (automount-1.2.tar.gz) = 3448 +SHA256 (automount-1.2.1.tar.gz) = cfb646a24c06630f29979a6834096587a0b564e2343502dcd0563c306d93b291 +SIZE (automount-1.2.1.tar.gz) = 3455