diff --git a/automount b/automount index 4e8db72..92ed6b8 100755 --- a/automount +++ b/automount @@ -22,7 +22,72 @@ # (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=/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 @@ -86,9 +151,6 @@ case ${2} in ;; (*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 ntfsfix 1> /dev/null 2> /dev/null && { - ntfsfix ${DEV} # sysutils/ntfsprogs - } which ntfs-3g 1> /dev/null 2> /dev/null && { 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 (EXFAT) mount.exfat -o noatime ${DEV} ${MNT} && ADD=1 # sysutils/fusefs-exfat - __log "${DEV}:mount (ufs)" + __log "${DEV}:mount (exfat)" ;; esac ;; @@ -148,8 +210,7 @@ case ${2} in __log "${DEV}:umount" done __log "${DEV}:detach" + find ${MNTPREFIX} -type d -empty -maxdepth 1 -delete ;; esac - -find ${MNTPREFIX} -type d -empty -delete diff --git a/port/distfiles/automount-1.0.tar.gz b/port/distfiles/automount-1.0.tar.gz index 7228a94..fd4b11d 100644 Binary files a/port/distfiles/automount-1.0.tar.gz and b/port/distfiles/automount-1.0.tar.gz differ diff --git a/port/distfiles/automount-1.0/automount b/port/distfiles/automount-1.0/automount index 4e8db72..92ed6b8 100755 --- a/port/distfiles/automount-1.0/automount +++ b/port/distfiles/automount-1.0/automount @@ -22,7 +22,72 @@ # (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=/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 @@ -86,9 +151,6 @@ case ${2} in ;; (*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 ntfsfix 1> /dev/null 2> /dev/null && { - ntfsfix ${DEV} # sysutils/ntfsprogs - } which ntfs-3g 1> /dev/null 2> /dev/null && { 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 (EXFAT) mount.exfat -o noatime ${DEV} ${MNT} && ADD=1 # sysutils/fusefs-exfat - __log "${DEV}:mount (ufs)" + __log "${DEV}:mount (exfat)" ;; esac ;; @@ -148,8 +210,7 @@ case ${2} in __log "${DEV}:umount" done __log "${DEV}:detach" + find ${MNTPREFIX} -type d -empty -maxdepth 1 -delete ;; esac - -find ${MNTPREFIX} -type d -empty -delete diff --git a/port/sysutils/automount/Makefile b/port/sysutils/automount/Makefile index 952c3dd..b5bc56b 100644 --- a/port/sysutils/automount/Makefile +++ b/port/sysutils/automount/Makefile @@ -7,6 +7,7 @@ PORTNAME= automount PORTVERSION= 1.0 +LICENSE= BSD CATEGORIES= sysutils 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 -do-build: +NO_BUILD= yes do-install: ${INSTALL_SCRIPT} ${WRKSRC}/automount ${PREFIX}/sbin ${INSTALL_DATA} ${WRKSRC}/automount_devd.conf ${PREFIX}/etc/devd/automount_devd.conf ${INSTALL_DATA} ${WRKSRC}/automount.conf.sample ${PREFIX}/etc/automount.conf.sample - /etc/rc.d/devd restart + ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL .include diff --git a/port/sysutils/automount/distinfo b/port/sysutils/automount/distinfo index 76098a2..97f205b 100644 --- a/port/sysutils/automount/distinfo +++ b/port/sysutils/automount/distinfo @@ -1,3 +1,2 @@ -MD5 (automount-1.0.tar.gz) = 050d33273d952436b492eaa9c13bcfb5 -SHA256 (automount-1.0.tar.gz) = dcbe2f11742c92ad9c2bc7d7c33b73efb9148cac46507edd505b4a4fa7198253 -SIZE (automount-1.0.tar.gz) = 2553 +SHA256 (automount-1.0.tar.gz) = 3ff5c3a251877624da7caf7d0594e85312a4e9c96a22a30fdf34d1fd302b5f4f +SIZE (automount-1.0.tar.gz) = 3254 diff --git a/port/sysutils/automount/pkg-install b/port/sysutils/automount/pkg-install new file mode 100644 index 0000000..5efa21e --- /dev/null +++ b/port/sysutils/automount/pkg-install @@ -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 +