| 1 |
#!/bin/sh |
| 2 |
# /usr/local/sbin/dphys-config-usb-storage - load modules for USB storage |
| 3 |
# author Neil Franklin, last modification 2006.10.13 |
| 4 |
# copyright ETH Zuerich Physics Departement, |
| 5 |
# use under either modified/non-advertising BSD or GPL license |
| 6 |
|
| 7 |
# this script is called by dphys-config, once on each script install/update |
| 8 |
# no parameters or environment variables are evaluated |
| 9 |
# it requires in /etc/dphys-config.list 1 line: |
| 10 |
# local/sbin/dphys-config-usb-storage:/usr/:chmod 755 {}; {} |
| 11 |
|
| 12 |
|
| 13 |
set -e |
| 14 |
|
| 15 |
# get ready to work |
| 16 |
# /usr/local added for FreeBSD, because their ports end up in there |
| 17 |
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin |
| 18 |
export PATH |
| 19 |
|
| 20 |
|
| 21 |
# install and load kernel modules needed for USB storage |
| 22 |
# usbcore is needed for all USB stuff, should be already in, but go safe |
| 23 |
# sd_mod is SCSI disk, for logging scsi<n> numbers to /dev/sd<x> names map |
| 24 |
# this is missing in Debian Linux 3.1 (sarge) standard kernels |
| 25 |
# usb-storage is generic USB storage device protocol |
| 26 |
for MODULE in usbcore sd_mod usb-storage ; do |
| 27 |
# insert them into /etc/modules for after future boots |
| 28 |
grep ${MODULE} /etc/modules > /dev/null || echo ${MODULE} >> /etc/modules |
| 29 |
# insert them into the running kernel for this session |
| 30 |
# use || true so we can try nonexisting other kernel version modules |
| 31 |
# else set -e will nuke this script when we try this |
| 32 |
grep "^${MODULE}" /proc/modules > /dev/null || \ |
| 33 |
modprobe ${MODULE} 2> /dev/null || true |
| 34 |
done |
| 35 |
|
| 36 |
exit 0 |