# do not add or remove root device again...
[ "$ROOTDEV" = "$MDEV" ] && exit 0
+if [ -e /tmp/.nomdevmount ]; then
+ log_info "no action on $MDEV -- /tmp/.nomdevmount exists"
+ exit 0
+fi
create_symlinks() {
DEVBASE=${MDEV:0:3} # first 3 characters
if [ -n "$LABEL" ]; then
rm -f "$LABEL"
ln -s $MDEV "$LABEL"
- elif [ -n "$MODEL" ]; then
+ fi
+ if [ -n "$UUID" ]; then
+ LINK="${TYPE}${TYPE:+-}${UUID}"
+ rm -f "${LINK}"
+ ln -s $MDEV "${LINK}"
+ fi
+ if [ -n "$MODEL" ]; then
LINK="${MODEL}${PARTNUM:+-}${PARTNUM}"
rm -f "${LINK}"
ln -s $MDEV "${LINK}"
- elif [ -n "$UUID" ]; then
- LINK="${TYPE}${TYPE:+-}${UUID}"
+ fi
+ BUS=""
+ PORT=""
+ P=$PHYSDEVPATH
+ case "$P" in
+ /devices/platform/cx2450x-ehci.?/usb?/?-?/?-?.?/?-?.?:?.?/host*) # hub
+ PORT=${P#*.*.} # strip off /devices/platform/cx2450x-ehci.?/usb?/?-?/?-?
+ PORT=${PORT%%/*} # strip off /?-?.?:?.?/host*, leaving the port
+ BUS="usb-${P:31:1}-hub-${PORT}"
+ ;;
+ /devices/platform/cx2450x-ehci.?/usb?/?-?/?-?:?.?/host*) # no hub
+ BUS="usb-${P:31:1}"
+ ;;
+ /devices/platform/cnxt_sata?-?.?/host*)
+ BUS="sata-${P:27:1}"
+ ;;
+ *)
+ # BUS="unknown" # ignored for now
+ ;;
+ esac
+ if [ -n "$BUS" ]; then
+ LINK="${BUS}${PARTNUM:+-}${PARTNUM}"
rm -f "${LINK}"
ln -s $MDEV "${LINK}"
- else
- BUS=""
- PORT=""
- P=$PHYSDEVPATH
- case "$P" in
- /devices/platform/cx2450x-ehci.?/usb?/?-?/?-?.?/?-?.?:?.?/host*) # hub
- PORT=${P#*.*.} # strip off /devices/platform/cx2450x-ehci.?/usb?/?-?/?-?
- PORT=${PORT%%/*} # strip off /?-?.?:?.?/host*, leaving the port
- BUS="usb-${P:31:1}-hub-${PORT}"
- ;;
- /devices/platform/cx2450x-ehci.?/usb?/?-?/?-?:?.?/host*) # no hub
- BUS="usb-${P:31:1}"
- ;;
- /devices/platform/cnxt_sata?-?.?/host*)
- BUS="sata-${P:27:1}"
- ;;
- *)
- # BUS="unknown" # ignored for now
- ;;
- esac
- if [ -n "$BUS" ]; then
- LINK="${BUS}${PARTNUM:+-}${PARTNUM}"
- rm -f "${LINK}"
- ln -s $MDEV "${LINK}"
- fi
fi
cd $OLDPWD
# remove old mountpoint symlinks we might have for this device
rm -f $MOUNTPOINT
mkdir -p $MOUNTPOINT
- for i in 1 2; do # retry, my freeagent drive sometimes needs more time
+ for i in 1 2 3 4 5; do # retry, my freeagent drive sometimes needs more time
# $LOG "mounting /dev/$MDEV to $MOUNTPOINT try $i"
OUT1=$(mount -t auto /dev/$MDEV $MOUNTPOINT 2>&1 >/dev/null)
RET1=$?
fi
rmdir $MOUNTPOINT
fi
+ if [ -x /bin/mdev_helper ]; then
+ /bin/mdev_helper
+ fi
;;
remove)
$LOG "unmounting /dev/$MDEV"
else
$WARN "umount /dev/$MDEV failed with $RET"
fi
+ if [ -x /bin/mdev_helper ]; then
+ /bin/mdev_helper
+ fi
;;
esac
+