#! /bin/sh #---------------------------------------------------------------------------- # system-devices-mount-usb - mount usb device # # Copyright (c) 2005 Frank Meyer # # Creation : 14.11.2003 fm # Last Update: $Id$ # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. #---------------------------------------------------------------------------- echo . /var/install/include/eislib mountpath=/usb case `uname -r` in 2.2.*) mecho -error "Error: you need kernel 2.4.x to mount an USB device" anykey exit 1 ;; esac /sbin/modprobe usb-storage >/dev/null 2>&1 /sbin/modprobe sd_mod >/dev/null 2>&1 /sbin/modprobe usb-uhci >/dev/null 2>&1 /sbin/modprobe usb-ohci >/dev/null 2>&1 /sbin/modprobe ehci-hcd >/dev/null 2>&1 mkdir $mountpath 2>/dev/null sleep 3 if [ -z "`mount -t usbdevfs`" ] then /bin/mount -t usbdevfs usbdevfs /proc/bus/usb fi if /var/install/bin/ask "Mount USB device as raw device" then for a in /dev/sd[a-o] do if [ -z "`/bin/mount | grep "^$a "`" ] then dev=$a mecho -info "found free device $dev..." break fi done else for a in /dev/sd[a-o] do if [ -z "`/bin/mount | grep "^$a"`" ] then dev="$a"1 mecho -info "found free device $dev..." break fi done fi option="vfat" /bin/mount -t $option $dev $mountpath if [ $? = 0 ] then mecho -info "mount successful with option $option, path is $mountpath." retval="0" else mecho -error "mounting $dev to $mountpath with option $option failed." option="auto" mecho -error "trying mount with option $option instead..." retval="1" /bin/mount -t $option $dev $mountpath if [ $? = 0 ] then mecho -info "mount successful with option $option, path is $mountpath." retval="0" else mecho -error "mounting $dev to $mountpath with option $option failed." fi fi echo anykey exit $retval