]> git.pld-linux.org Git - packages/util-vserver.git/blame - vrootdevices.init
- rel 2; build with glibc, so it will also work on systems with newer kernels that...
[packages/util-vserver.git] / vrootdevices.init
CommitLineData
f40a7521
JR
1#!/bin/sh
2#
3# vrootdevices: setup vroot devices
4#
5# chkconfig: 345 97 03
6# description: Setup vroot devices for use inside vservers
7
8# Source function library
9. /etc/rc.d/init.d/functions
10
8989d944 11assign_vroot()
f40a7521 12{
8989d944 13 cat /etc/sysconfig/vrootdevices | egrep -v '^ *#' | while read VROOT BLOCK; do
f40a7521
JR
14 if [ -n "$VROOT" -a -n "$BLOCK" ]; then
15 if [ -d /dev/vroot ]; then
16 VROOT="/dev/vroot/$VROOT"
17 else
18 VROOT="/dev/vroot$VROOT"
19 fi
20 show "$(nls "Assigning device: %s --> %s" "$VROOT" "$BLOCK")"
21 busy
22 vrsetup $VROOT $BLOCK > /dev/null
23 ok
24 fi
25 done
26}
27
8989d944 28remove_vroot()
f40a7521 29{
8989d944 30 cat /etc/sysconfig/vrootdevices | egrep -v '^ *#' | while read VROOT BLOCK; do
f40a7521
JR
31 if [ -n "$VROOT" -a -n "$BLOCK" ]; then
32 if [ -d /dev/vroot ]; then
33 VROOT="/dev/vroot/$VROOT"
34 else
35 VROOT="/dev/vroot$VROOT"
36 fi
37 show "$(nls "Removing assignment: %s --> %s" "$VROOT" "$BLOCK")"
38 busy
39 vrsetup -d $VROOT > /dev/null
40 ok
41 fi
42 done
43}
44
945c1639 45start() {
f40a7521
JR
46 if [ ! -f /var/lock/subsys/vrootdevices ]; then
47 msg_starting vrootdevices
48 ok
49 assign_vroot
50 touch /var/lock/subsys/vrootdevices
51 else
52 msg_already_running vrootdevices
53 fi
945c1639 54}
f40a7521 55
945c1639 56stop() {
f40a7521
JR
57 if [ -f /var/lock/subsys/vrootdevices ]; then
58 msg_stopping vrootdevices
59 ok
60 remove_vroot
61 rm -f /var/lock/subsys/vrootdevices >/dev/null 2>&1
62 else
63 msg_not_running vrootdevices
64 fi
945c1639
ER
65}
66
67case "$1" in
68 start|reload)
69 start
70 ;;
71 stop)
72 stop
f40a7521 73 ;;
f40a7521 74 restart|force-reload)
945c1639
ER
75 stop
76 start
8989d944 77 ;;
5e118b6e
ER
78 status)
79 echo "There is no way to tell"
80 ;;
f40a7521 81 *)
945c1639 82 msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
f40a7521
JR
83 exit 3
84 ;;
85esac
86
87exit $RETVAL
This page took 0.082896 seconds and 4 git commands to generate.