#!/bin/sh # /usr/local/sbin/dphys-config-usb-storage - load modules for USB storage # author Neil Franklin, last modification 2006.10.13 # 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 1 line: # local/sbin/dphys-config-usb-storage:/usr/:chmod 755 {}; {} set -e # get ready to work # /usr/local added for FreeBSD, because their ports end up in there PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/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 grep ${MODULE} /etc/modules > /dev/null || echo ${MODULE} >> /etc/modules # insert them into the running kernel for this session # use || true so we can try nonexisting other kernel version modules # else set -e will nuke this script when we try this grep "^${MODULE}" /proc/modules > /dev/null || \ modprobe ${MODULE} 2> /dev/null || true done exit 0