Fix filesystem initialization order

Fsck filesystems before mounting root as read-write. Mountdev and
device creation can stay there because they're tmpfs.

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
This commit is contained in:
Claudio Matsuoka committed 2008-08-13 13:14:33 -03:00
1 parent b0e3dbc47f
commit a6f534621c
2 files changed
+17 -10

No files matched your search

+1 -1
View File
@@ -7,7 +7,7 @@ VERSION = 0.5-pre
PKG = finit-$(VERSION)
DFILES = Makefile README finit.c finit-mod.c finit-alt.c helpers.c helpers.h \
patches/*patch contrib/services.sh*
BINS = finit-mod finit-alt finit-mdv finit-exb
BINS = finit-mod finit-alt finit-mdv #finit-exb
+16 -9
View File
@@ -146,6 +146,10 @@ static void build_cmd(char *cmd, char *x, int len)
#ifdef LISTEN_INITCTL
/* Standard reboot/shutdown utilities talk to init using /dev/initctl.
* We should check if the fifo was recreated and reopen it.
*/
static void listen_initctl()
{
if (!fork()) {
@@ -255,15 +259,6 @@ int main()
setsid();
/*
* Mount filesystems
*/
#ifdef REMOUNT_ROOTFS_RW
system("/bin/mount -n -o remount,rw /");
#endif
umask(0);
/*
* Parse configuration file
*/
@@ -276,6 +271,7 @@ int main()
if (debug)
printf("conf: %s\n", line);
/* Do this before mounting / read-write */
if (MATCH_CMD(line, "check ", x)) {
strcpy(cmd, "/sbin/fsck -C -a ");
build_cmd(cmd, x, CMD_SIZE);
@@ -315,6 +311,9 @@ int main()
blkdev("/dev/sda6", 0660, 8, 6);
continue;
}
/* This works only if /dev is tmpfs! If not, create
* devices statically on the filesystem
*/
if (MATCH_CMD(line, "mknod ", x)) {
strcpy(cmd, "/bin/mknod ");
build_cmd(cmd, x, CMD_SIZE);
@@ -326,6 +325,14 @@ int main()
fclose(f);
}
/*
* Mount filesystems
*/
#ifdef REMOUNT_ROOTFS_RW
system("/bin/mount -n -o remount,rw /");
#endif
umask(0);
#ifdef MAKE_DEVICES
mkdir("/dev/shm", 0755);
mkdir("/dev/pts", 0755);