mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-11-19 19:37:30 +02:00
ed5ef674d1
git-svn-id: svn://svn.openwrt.org/openwrt/branches/buildroot-ng/openwrt@4090 3c298f89-4303-0410-b956-a3cf2f4a3e73
53 lines
934 B
Bash
53 lines
934 B
Bash
#!/bin/sh
|
|
# Copyright (C) 2006 OpenWrt.org
|
|
|
|
mount_storage() {
|
|
cd /dev/discs
|
|
for dev in disc*; do
|
|
[ -f /tmp/.${dev}_id ] || {
|
|
echo ${INTERFACE}${PRODUCT} > /tmp/.${dev}_id
|
|
mount | grep /mnt/${dev} || (
|
|
[ -d /mnt/. ] || {
|
|
mkdir -p /tmp/mnt
|
|
ln -s /tmp/mnt /
|
|
}
|
|
cd $dev
|
|
for part in part*; do
|
|
path=/mnt/${dev}_${part##*part}
|
|
mkdir -p ${path}
|
|
mount ${part} ${path}
|
|
done
|
|
)
|
|
}
|
|
done
|
|
}
|
|
|
|
umount_storage() {
|
|
for tmp in /tmp/.*_id; do
|
|
id=$(cat $tmp 2>&-)
|
|
[ "${INTERFACE}${PRODUCT}" = "$id" ] && {
|
|
rm -f $tmp
|
|
disc=${tmp##*disc}
|
|
disc=${disc%%_id}
|
|
for disc in /mnt/disc${disc}*; do
|
|
umount -f $disc || umount -l $disc
|
|
done
|
|
}
|
|
done
|
|
}
|
|
|
|
[ -f /proc/bus/usb/devices ] || mount -t usbfs none /proc/bus/usb
|
|
|
|
case "$ACTION" in
|
|
add)
|
|
case "${INTERFACE%%/*}" in
|
|
8) mount_storage ;;
|
|
esac
|
|
;;
|
|
remove)
|
|
case "${INTERFACE%%/*}" in
|
|
8) umount_storage ;;
|
|
esac
|
|
;;
|
|
esac
|