]> git.pld-linux.org Git - packages/util-vserver.git/blob - vrootdevices.init
- rel 2; build with glibc, so it will also work on systems with newer kernels that...
[packages/util-vserver.git] / vrootdevices.init
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
11 assign_vroot()
12 {
13         cat /etc/sysconfig/vrootdevices | egrep -v '^ *#' | while read VROOT BLOCK; do
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
28 remove_vroot()
29 {
30         cat /etc/sysconfig/vrootdevices | egrep -v '^ *#' | while read VROOT BLOCK; do
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
45 start() {
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
54 }
55
56 stop() {
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
65 }
66
67 case "$1" in
68   start|reload)
69         start
70         ;;
71   stop)
72         stop
73         ;;
74   restart|force-reload)
75         stop
76         start
77         ;;
78   status)
79         echo "There is no way to tell"
80         ;;
81   *)
82         msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
83         exit 3
84         ;;
85 esac
86
87 exit $RETVAL
This page took 0.038796 seconds and 3 git commands to generate.