#!/bin/sh # /usr/local/sbin/dphys-config-usb-storage - load modules for USB storage # author Neil Franklin, last modification 2006.09.14 # copyright ETH Zuerich Physics Departement, # use under either modified/non-advertising BSD or GPL license # this script is called by dphys-config, once on each script install/update # no parameters or environment variables are evaluated # it requires in /etc/dphys-config.list 2 lines: # usb-storage.dev:/etc/dev.d/block/:/bin/chmod 755 {} # local/sbin/dphys-config-usb-storage:/usr/:/bin/chmod 755 {}; {} set -e # get ready to work PATH=/sbin:/bin:/usr/sbin:/usr/bin export PATH # install and load kernel modules needed for USB storage # usbcore is needed for all USB stuff, should be already in, but go safe # sd_mod is SCSI disk, for logging scsi numbers to /dev/sd names map # this is missing in Debian Linux 3.1 (sarge) standard kernels # usb-storage is generic USB storage device protocol for MODULE in usbcore sd_mod usb-storage ; do # insert them into /etc/modules for after future boots /bin/grep ${MODULE} /etc/modules > /dev/null || \ /bin/echo ${MODULE} >> /etc/modules # insert them into the running kernel for this session # use || /bin/true so we can try nonexisting other kernel version modules # else set -e will nuke this script when we try this /bin/grep '^${MODULE}' /proc/modules > /dev/null || \ /sbin/modprobe ${MODULE} 2> /dev/null || /bin/true done exit 0