diff --git a/package/lean/automount/Makefile b/package/lean/automount/Makefile new file mode 100644 index 000000000..551217102 --- /dev/null +++ b/package/lean/automount/Makefile @@ -0,0 +1,36 @@ +# +# Copyright (C) 2010-2011 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=automount +PKG_VERSION:=1 +PKG_RELEASE:=19 +PKG_ARCH:=all + +include $(INCLUDE_DIR)/package.mk + +define Package/automount + TITLE:=Mount autoconfig hotplug script. + MAINTAINER:=Lean + DEPENDS:=block-mount +kmod-usb-storage +kmod-usb-storage-extras +kmod-fs-vfat +ntfs-3g +kmod-fs-ext4 +endef + +define Package/automount/description +A usb autoconfig hotplug script. +endef + +define Build/Compile +endef + +define Package/automount/install + $(INSTALL_DIR) $(1)/etc/uci-defaults + $(INSTALL_BIN) ./files/15-automount $(1)/etc/15-automount + $(INSTALL_BIN) ./files/zzz-move-automount $(1)/etc/uci-defaults/zzz-move-automount +endef + +$(eval $(call BuildPackage,automount)) diff --git a/package/lean/automount/files/15-automount b/package/lean/automount/files/15-automount new file mode 100755 index 000000000..dd518c4ec --- /dev/null +++ b/package/lean/automount/files/15-automount @@ -0,0 +1,27 @@ +#!/bin/sh + +# Copyright (C) 2015 OpenWrt.org + +# 0 yes blockdevice handles this - 1 no it is not there +blkdev=`dirname $DEVPATH` +basename=`basename $blkdev` +device=`basename $DEVPATH` +skip=`block info | sed 's/\(.*\): .*/\1/' | grep -q $device ; echo $?` +path=$DEVPATH + +if [ $basename != "block" ] && [ -z "${device##sd*}" ] && [ $skip -eq 1 ]; then + mntpnt=$device + case "$ACTION" in + add) + mkdir -p /mnt/$mntpnt + chmod 777 /mnt/$mntpnt + # Try to be gentle on solid state devices + mount -o rw,noatime,discard /dev/$device /mnt/$mntpnt + ;; + remove) + # Once the device is removed, the /dev entry disappear. We need mountpoint + mountpoint=`mount |grep /dev/$device | sed 's/.* on \(.*\) type.*/\1/'` + umount -l $mountpoint + ;; + esac +fi \ No newline at end of file diff --git a/package/lean/automount/files/zzz-move-automount b/package/lean/automount/files/zzz-move-automount new file mode 100755 index 000000000..fbe094cbd --- /dev/null +++ b/package/lean/automount/files/zzz-move-automount @@ -0,0 +1,7 @@ +#!/bin/sh + +sleep 15 +mv /etc/15-automount /etc/hotplug.d/block/ + + +