依赖blkid
opkg install blkid
#!/bin/sh
# Copyright (C) 2015 OpenWrt.org
# 修改:805447391@qq.com
# 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=`blkid -s UUID /dev/$device | awk '{print $2}' | sed 's/UUID=\"//g' | sed 's/\"//g'`
case "$ACTION" in
add)
mkdir -p /mnt/by-uuid/$mntpnt
chmod 777 /mnt/by-uuid/$mntpnt
# Try to be gentle on solid state devices
mount -o rw,noatime,discard /