summaryrefslogtreecommitdiff
blob: 20812b08901b80b07774d9e1ca2ff7f969ed3238 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/sbin/runscript
# Copyright 1999-2002 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo/src/livecd/profiles/global/aux-files/Attic/checkroot,v 1.1 2003/10/19 03:10:52 livewire Exp $


depend() {
	before *
}

start() {
	if [ ! -f /fastboot ]
	then
		ebegin "Remounting root filesystem read-only (if necessary)"
		mount / -n -o remount,ro &>/dev/null
		eend $?

		ebegin "Checking root filesystem"
		if [ -f /forcefsck ]
		then
			ewarn "A full fsck has been forced"
			ewarn "Skipping fsck; this is a livecd"
#			fsck -C -f -a /
			# /forcefsck isn't deleted because checkfs needs it.
			# it'll be deleted in that script.	
		fi
		if [ "$?" -eq 0 ]
		then
			eend 0
		elif [ "$?" -eq 1 ]
		then
			ewend 1 "Filesystem repaired"
		else
			eend 2 "Filesystem couldn't be fixed :("
			/sbin/sulogin ${CONSOLE}
			/sbin/reboot -f
		fi
	fi

	ebegin "Remounting root filesystem read/write"
	mount / -n -o remount,rw &>/dev/null
	if [ "$?" -ne 0 ]
	then
		eend 2 "Root filesystem could not be mounted R/W :("
		/sbin/sulogin ${CONSOLE}
	else
		eend 0
	fi

	if [ "${BOOT}" = "yes" ]
	then
		# create /etc/mtab (done by forcing current mounted filesystems)
		# NB:  this needs to be updated if our /sbin/rc mounts change ...
		> /etc/mtab
		mount -f -o rw / &> /dev/null
		mount -f /proc &> /dev/null

		# Remove stale backups
		rm -f /etc/mtab~ /etc/mtab~~
		
		# should /dev be mounted ?
		if ! get_bootparam "nodevfs" && [ -e /dev/.devfsd ]
		then
			mount -f -t devfs none /dev &> /dev/null
		fi
		
		# should we mount a ramdisk or tmpfs?
		if ! get_bootparam "notmpfs" 
		then
			# using tmpfs
			mount -f -t tmpfs tmpfs ${svcdir} \
				-o rw,mode=0644,size=${svcsize}k &> /dev/null
		else
			# using a ramdisk
			mount -f -t ext2 /dev/ram0 ${svcdir} -o rw &> /dev/null
		fi

		if ! get_bootparam "notmpfs" && get_bootparam "ngpt"
		then
			# POSIX shared memory support
			mount -f /dev/shm &> /dev/null
		fi
	fi
}


# vim:ts=4