diff options
author | Bill Nottingham <notting@redhat.com> | 2000-07-25 04:34:38 +0000 |
---|---|---|
committer | Bill Nottingham <notting@redhat.com> | 2000-07-25 04:34:38 +0000 |
commit | 388413615cce14fb70e2f4d0772343d6e471d7bc (patch) | |
tree | 4fe836b22a8e103a8fe94d23e8f4bc6073750984 | |
parent | 8cd59fa2f6ea28c9884a4bda6c354a73dc085337 (diff) | |
download | initscripts-388413615cce14fb70e2f4d0772343d6e471d7bc.tar initscripts-388413615cce14fb70e2f4d0772343d6e471d7bc.tar.gz initscripts-388413615cce14fb70e2f4d0772343d6e471d7bc.tar.bz2 initscripts-388413615cce14fb70e2f4d0772343d6e471d7bc.tar.xz initscripts-388413615cce14fb70e2f4d0772343d6e471d7bc.zip |
add raw device support from karsten
-rw-r--r-- | initscripts.spec | 2 | ||||
-rw-r--r-- | rawdevices | 5 | ||||
-rwxr-xr-x | rc.d/init.d/rawdevices | 79 | ||||
-rw-r--r-- | sysconfig.txt | 10 |
4 files changed, 96 insertions, 0 deletions
diff --git a/initscripts.spec b/initscripts.spec index 6dda7972..d0dc755c 100644 --- a/initscripts.spec +++ b/initscripts.spec @@ -84,6 +84,7 @@ chmod 664 /var/log/wtmp /var/run/utmp chkconfig --add random chkconfig --add netfs chkconfig --add network +chkconfig --add rawdevices # handle serial installs semi gracefully if [ $1 = 0 ]; then @@ -109,6 +110,7 @@ if [ $1 = 0 ]; then chkconfig --del random chkconfig --del netfs chkconfig --del network + chkconfig --del rawdevices fi %triggerpostun -- initscripts <= 5.04 diff --git a/rawdevices b/rawdevices new file mode 100644 index 00000000..3c776383 --- /dev/null +++ b/rawdevices @@ -0,0 +1,5 @@ +# raw device bindings +# format: <rawdev> <major> <minor> +# <rawdev> <blockdev> +# example: /dev/raw/raw1 /dev/sda1 +# /dev/raw/raw2 8 5 diff --git a/rc.d/init.d/rawdevices b/rc.d/init.d/rawdevices new file mode 100755 index 00000000..2d883ef0 --- /dev/null +++ b/rc.d/init.d/rawdevices @@ -0,0 +1,79 @@ +#!/bin/sh +# +# rawdevices This shell script assignes rawdevices to block devices +# +# chkconfig: 345 56 44 +# description: This scripts assignes raw devices to block devices \ +# (such as hard drive partitions). This is for the use \ +# of applications such as Oracle. You can set up the \ +# raw device to block device mapping by editing \ +# the file /etc/sysconfig/rawdevices. +# config: /etc/sysconfig/rawdevices + +# Source function library. +. /etc/init.d/functions + +[ -f /usr/bin/raw ] || exit 0 +[ -f /etc/sysconfig/rawdevices ] || exit 0 + +# If the file just has the default comments, exit. +grep -q -v "^#" /etc/sysconfig/rawdevices 2>/dev/null || exit 0 + +PATH=/usr/bin:/bin:/usr/sbin:/sbin + +function assign_raw() +{ + cat /etc/sysconfig/rawdevices | egrep -v '^ *#' | while read RAW BLOCK; do + if [ -n "$RAW" -a -n "$BLOCK" ]; then + if [ "`dirname $RAW`" = "/dev" -a -d /dev/raw ]; then + echo " Please correct your /etc/sysconfig/rawdevices:" + echo " rawdevices are now located in the directory /dev/raw/ " + echo " If the command 'raw' still refers to /dev/raw as a file." + echo " you'll have to upgrade your util-linux package" + exit 0 + fi + if [ "`dirname $RAW`" = "/dev/raw" -a -f /dev/raw ]; then + echo " Please correct your /etc/sysconfig/rawdevices:" + echo " rawdevices are now located in the directory /dev/raw/ " + echo " If the command 'raw' still refers to /dev/raw as a file." + echo " you'll have to upgrade your util-linux package" + exit 0 + fi + + echo " $RAW --> $BLOCK"; + raw $RAW $BLOCK + fi + done +} + +# See how we were called. +case "$1" in + start) + # Assign devices + echo "Assigning devices: " + assign_raw + echo "done" + ;; + stop) + # No action to be taken here + ;; + + status) + ID=`id -u` + if [ $ID -eq 0 ]; then + raw -qa + else + echo "You need to be root to use this command ! " + fi + ;; + + restart|reload) + $0 start + ;; + + *) + echo "Usage: rawdevice {start|stop|status|restart}" + exit 1 +esac + +exit 0 diff --git a/sysconfig.txt b/sysconfig.txt index 1e874170..07fc0ed2 100644 --- a/sysconfig.txt +++ b/sysconfig.txt @@ -157,6 +157,16 @@ Files in /etc/sysconfig SILENT=yes|no EXPORT_GATEWAY=yes|no + +/etc/sysconfig/rawdevices: + + This is used for setting up raw device to block device mappings. + It has the format: + <rawdev> <major> <minor> + <rawdev> <blockdev> + For example: + /dev/raw/raw1 /dev/sda1 + /dev/raw/raw2 8 5 /etc/sysconfig/pcmcia: |