freebsd-dev/etc/rc.d/root
Ruslan Ermilov 6affdd3055 "-o rw" is invalid and undocumented mount option that
is only present for fstab(5) compatibility, and is
otherwise ignored by mount(8) (not passed to mount_*
programs, and not passed to nmount(2)).

"-u -o rw" worked with an old mount(8) with mount_ufs.c
because "-o rw" was stripped and simple "-u" caused an
update of UFS from read-only to read-write, due to
inability of mount(2) to track changes in options
(MNT_RDONLY is either set or not).

"-u" no longer causes the transition from RO to RW,
now that mount(8) was converted to use nmount(2), so
an explicit change to RW is required.  Keep up with
this change, and use "-uw" to mount root read-write.
2005-12-02 21:33:43 +00:00

44 lines
732 B
Bash
Executable File

#!/bin/sh
#
# $NetBSD: root,v 1.2 2000/05/13 08:45:09 lukem Exp $
# $FreeBSD$
#
# PROVIDE: root
# REQUIRE: fsck
# KEYWORD: nojail
. /etc/rc.subr
name="root"
start_cmd="root_start"
stop_cmd=":"
root_start()
{
# root normally must be read/write, but if this is a BOOTP NFS
# diskless boot it does not have to be.
#
case ${root_rw_mount} in
[Nn][Oo] | '')
;;
*)
if ! mount -uw /; then
echo 'Mounting root filesystem rw failed, startup aborted'
/bin/kill -QUIT $$
fi
;;
esac
umount -a >/dev/null 2>&1
# If we booted a special kernel remove the record
# so we will boot the default kernel next time.
if [ -e /boot/nextkernel ]; then
rm -f /boot/nextkernel
fi
}
load_rc_config $name
run_rc_command "$1"