From da1f0a03d1a9ae65f36102e71120a3cfe7dd432c Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Tue, 12 Oct 2004 01:00:13 +0000 Subject: return of rawdevices stuff --- ChangeLog | 10 +++++++ initscripts.spec | 5 +++- rc.d/init.d/rawdevices | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++ sysconfig/rawdevices | 8 +++++ 4 files changed, 102 insertions(+), 1 deletion(-) create mode 100755 rc.d/init.d/rawdevices create mode 100644 sysconfig/rawdevices diff --git a/ChangeLog b/ChangeLog index 632650d2..141c4b1f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +commit 063bde81b8fcd430aa68312c80a514717b6ccd71 +Author: Harald Hoyer +Date: Tue May 5 11:19:13 2009 +0200 + + version 8.45.26 + + ChangeLog | 92 +++++++++++++++++++++++++++++++++++------------------- + initscripts.spec | 8 +++- + 2 files changed, 66 insertions(+), 34 deletions(-) + commit c03da3323fb88bce8f4978a8a4ca849b1f31298d Author: Harald Hoyer Date: Mon May 4 16:19:16 2009 +0200 diff --git a/initscripts.spec b/initscripts.spec index db175834..0f5e0ec7 100644 --- a/initscripts.spec +++ b/initscripts.spec @@ -71,17 +71,19 @@ chmod 600 /var/log/btmp /sbin/chkconfig --add netfs /sbin/chkconfig --add network /sbin/chkconfig --add netconsole +/sbin/chkconfig --add rawdevices + %preun if [ $1 = 0 ]; then /sbin/chkconfig --del netfs /sbin/chkconfig --del network /sbin/chkconfig --del netconsole + /sbin/chkconfig --del rawdevices fi %triggerun -- initscripts < 7.62 /sbin/chkconfig --del random -/sbin/chkconfig --del rawdevices exit 0 %clean @@ -105,6 +107,7 @@ rm -rf $RPM_BUILD_ROOT %dir /etc/sysconfig/networking/devices %dir /etc/sysconfig/networking/profiles %dir /etc/sysconfig/networking/profiles/default +%config(noreplace) /etc/sysconfig/rawdevices %config /etc/sysconfig/network-scripts/network-functions %config /etc/sysconfig/network-scripts/network-functions-ipv6 %config /etc/sysconfig/network-scripts/init.ipv6-global diff --git a/rc.d/init.d/rawdevices b/rc.d/init.d/rawdevices new file mode 100755 index 00000000..67954d17 --- /dev/null +++ b/rc.d/init.d/rawdevices @@ -0,0 +1,80 @@ +#!/bin/bash +# +# 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. Note that the use \ +# of raw devices is deprecated, and applications should \ +# open regular block devices with O_DIRECT instead. +# +# config: /etc/sysconfig/rawdevices + +[ -f /usr/bin/raw ] || exit 0 +[ -f /etc/sysconfig/rawdevices ] || exit 0 +# Exit if the file just has the default comments. +LC_ALL=C /bin/egrep -q -v "^ *#" /etc/sysconfig/rawdevices 2>/dev/null || exit 0 + +. /etc/init.d/functions + +function assign_raw() +{ + LC_ALL=C egrep -v '^ *#' /etc/sysconfig/rawdevices | + while read RAW BLOCK; do + if [ -n "$RAW" -a -n "$BLOCK" ]; then + rawdirname=${RAW%/*} + if [ "$rawdirname" = "/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 [ "$rawdirname" = "/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: $0 {start|stop|status|restart}" + exit 1 +esac + +exit 0 diff --git a/sysconfig/rawdevices b/sysconfig/rawdevices new file mode 100644 index 00000000..69360f0e --- /dev/null +++ b/sysconfig/rawdevices @@ -0,0 +1,8 @@ +# This file and interface are deprecated. +# Applications needing raw device access should open regular +# block devices with O_DIRECT. +# raw device bindings +# format: +# +# example: /dev/raw/raw1 /dev/sda1 +# /dev/raw/raw2 8 5 -- cgit v1.2.1