]> git.pld-linux.org Git - packages/util-linux.git/blame - rawdevices.init
- AC-branch only,
[packages/util-linux.git] / rawdevices.init
CommitLineData
bac5fff1
PG
1#!/bin/bash
2#
df8fd0f8 3# rawdevices This shell script assignes rawdevices to block devices
bac5fff1 4#
df8fd0f8 5# chkconfig: 345 56 44
6# description: This scripts assignes raw devices to block devices \
7# (such as hard drive partitions). This is for the use \
8# of applications such as Oracle. You can set up the \
9# raw device to block device mapping by editing \
10# the file /etc/sysconfig/rawdevices.
11# config: /etc/sysconfig/rawdevices
bac5fff1 12
bac5fff1
PG
13[ -f /etc/sysconfig/rawdevices ] || exit 0
14
15# If the file just has the default comments, exit.
16grep -q -v "^#" /etc/sysconfig/rawdevices 2>/dev/null || exit 0
17
9a464799
ER
18# Source function library.
19. /etc/rc.d/init.d/functions
bac5fff1
PG
20
21function assign_raw()
22{
b06f5046
ER
23 cat /etc/sysconfig/rawdevices | egrep -v '^ *#' | while read RAW BLOCK; do
24 if [ -n "$RAW" -a -n "$BLOCK" ]; then
df8fd0f8 25 if [ "`dirname $RAW`" = "/dev" -a -d /dev/raw ]; then
26 nls " Please correct your /etc/sysconfig/rawdevices:"
27 nls " rawdevices are now located in the directory /dev/raw/ "
28 nls " If the command 'raw' still refers to /dev/raw as a file."
29 nls " You'll have to upgrade your util-linux package"
30 exit 0
31 fi
32 if [ "`dirname $RAW`" = "/dev/raw" -a -f /dev/raw ]; then
33 nls " Please correct your /etc/sysconfig/rawdevices:"
34 nls " rawdevices are now located in the directory /dev/raw/ "
35 nls " If the command 'raw' still refers to /dev/raw as a file."
36 nls " You'll have to upgrade your util-linux package"
37 exit 0
38 fi
bac5fff1 39
e457171e 40 show "$(nls "Assigning device: %s --> %s" "$RAW" "$BLOCK")"
df8fd0f8 41 busy
42 raw $RAW $BLOCK > /dev/null
43 ok
44 fi
45 done
bac5fff1
PG
46}
47
a38c175f 48start() {
df8fd0f8 49 if [ ! -f /var/lock/subsys/rawdevices ]; then
a29b23ad 50 msg_starting rawdevices
2aadaee6 51 ok
a29b23ad 52 assign_raw
76781b00 53 touch /var/lock/subsys/rawdevices
a29b23ad 54 else
34616d1c 55 msg_already_running rawdevices
a29b23ad 56 fi
a38c175f
ER
57}
58
59stop() {
df8fd0f8 60 if [ -f /var/lock/subsys/rawdevices ]; then
a29b23ad 61 msg_stopping rawdevices
2aadaee6 62 busy
a29b23ad 63 rm -f /var/lock/subsys/rawdevices >/dev/null 2>&1
2aadaee6 64 ok
a29b23ad 65 else
34616d1c 66 msg_not_running rawdevices
a29b23ad 67 fi
a38c175f
ER
68}
69
70# See how we were called.
71case "$1" in
72 start|reload)
73 start
74 ;;
75 stop)
76 stop
df8fd0f8 77 ;;
bac5fff1 78 status)
9a464799 79 raw -qa
df8fd0f8 80 ;;
ac9f4e12 81 restart|force-reload)
a38c175f
ER
82 stop
83 start
df8fd0f8 84 ;;
bac5fff1
PG
85
86 *)
ac9f4e12 87 msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
88 exit 3
bac5fff1
PG
89esac
90
91exit 0
This page took 0.575981 seconds and 4 git commands to generate.