]> git.pld-linux.org Git - packages/util-vserver.git/blob - vrootdevices.init
- rel 3; R texlive-fonts-rsfs
[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 # $Id$
9
10 # Source function library
11 . /etc/rc.d/init.d/functions
12
13 assign_vroot()
14 {
15         cat /etc/sysconfig/vrootdevices | egrep -v '^ *#' | while read VROOT BLOCK; do
16         if [ -n "$VROOT" -a -n "$BLOCK" ]; then
17                 if [ -d /dev/vroot ]; then
18                         VROOT="/dev/vroot/$VROOT"
19                 else
20                         VROOT="/dev/vroot$VROOT"
21                 fi
22                 show "$(nls "Assigning device: %s --> %s" "$VROOT" "$BLOCK")"
23                 busy
24                 vrsetup $VROOT $BLOCK > /dev/null
25                 ok
26         fi
27         done
28 }
29
30 remove_vroot()
31 {
32         cat /etc/sysconfig/vrootdevices | egrep -v '^ *#' | while read VROOT BLOCK; do
33         if [ -n "$VROOT" -a -n "$BLOCK" ]; then
34                 if [ -d /dev/vroot ]; then
35                         VROOT="/dev/vroot/$VROOT"
36                 else
37                         VROOT="/dev/vroot$VROOT"
38                 fi
39                 show "$(nls "Removing assignment: %s --> %s" "$VROOT" "$BLOCK")"
40                 busy
41                 vrsetup -d $VROOT > /dev/null
42                 ok
43         fi
44         done
45 }
46
47 start() {
48         if [ ! -f /var/lock/subsys/vrootdevices ]; then
49                 msg_starting vrootdevices
50                 ok
51                 assign_vroot
52                 touch /var/lock/subsys/vrootdevices
53         else
54                 msg_already_running vrootdevices
55         fi
56 }
57
58 stop() {
59         if [ -f /var/lock/subsys/vrootdevices ]; then
60                 msg_stopping vrootdevices
61                 ok
62                 remove_vroot
63                 rm -f /var/lock/subsys/vrootdevices >/dev/null 2>&1
64         else
65                 msg_not_running vrootdevices
66         fi
67 }
68
69 case "$1" in
70   start|reload)
71         start
72         ;;
73   stop)
74         stop
75         ;;
76   restart|force-reload)
77         stop
78         start
79         ;;
80   status)
81         echo "There is no way to tell"
82         ;;
83   *)
84         msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
85         exit 3
86         ;;
87 esac
88
89 exit $RETVAL
This page took 0.046092 seconds and 3 git commands to generate.