Bring RCNG in from 5.x and adjust config files and scripts accordingly.
[dragonfly.git] / etc / rc.d / root
1 #!/bin/sh
2 #
3 # $NetBSD: root,v 1.2 2000/05/13 08:45:09 lukem Exp $
4 # $FreeBSD: src/etc/rc.d/root,v 1.5 2002/10/31 02:06:05 gordon Exp $
5 # $DragonFly: src/etc/rc.d/root,v 1.1 2003/07/24 06:35:37 dillon Exp $
6 #
7
8 # PROVIDE: root
9 # REQUIRE: fsck
10 # KEYWORD: DragonFly FreeBSD NetBSD
11
12 . /etc/rc.subr
13
14 name="root"
15 start_cmd="root_start"
16 stop_cmd=":"
17
18 root_start()
19 {
20         case ${OSTYPE} in
21         DragonFly)
22                 # root normally must be read/write, but if this is a BOOTP NFS
23                 # diskless boot it does not have to be.
24                 #
25                 case ${root_rw_mount} in
26                 [Nn][Oo] | '')
27                         ;;
28                 *)
29                         if ! mount -u -o rw /; then
30                                 echo 'Mounting root filesystem rw failed, startup aborted'
31                                 exit 1
32                         fi
33                         ;;
34                 esac
35                 umount -a >/dev/null 2>&1
36                 mount /
37                 # If we booted a special kernel remove the record
38                 # so we will boot the default kernel next time.
39                 if [ -e /boot/nextkernel ]; then
40                         rm -f /boot/nextkernel
41                 fi
42                 ;;
43
44         FreeBSD)
45                 # root normally must be read/write, but if this is a BOOTP NFS
46                 # diskless boot it does not have to be.
47                 #
48                 case ${root_rw_mount} in
49                 [Nn][Oo] | '')
50                         ;;
51                 *)
52                         if ! mount -u -o rw /; then
53                                 echo 'Mounting root filesystem rw failed, startup aborted'
54                                 exit 1
55                         fi
56                         ;;
57                 esac
58
59                 umount -a >/dev/null 2>&1
60                 mount /
61
62                 # If we booted a special kernel remove the record
63                 # so we will boot the default kernel next time.
64                 if [ -e /boot/nextkernel ]; then
65                         rm -f /boot/nextkernel
66                 fi
67                 ;;
68         NetBSD)
69                 umount -a >/dev/null 2>&1
70                 mount /
71                 rm -f /fastboot
72                 ;;
73         esac
74 }
75
76 load_rc_config $name
77 run_rc_command "$1"