Allow creation of device nodes from configuration file

Using command "mknod", same syntax as mknod(1)

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
This commit is contained in:
Claudio Matsuoka
2008-08-11 18:03:52 -03:00
parent a187b88dd9
commit 9f83bbe788
+18 -15
View File
@@ -189,7 +189,6 @@ int main()
char username[USERNAME_SIZE] = DEFUSER;
char hostname[HOSTNAME_SIZE] = "eviltwin";
char cmd[CMD_SIZE];
int mountdev = 0;
#ifdef USE_ETC_RESOLVCONF_RUN
DIR *dir;
struct dirent *d;
@@ -250,6 +249,17 @@ int main()
fclose(f);
}
setsid();
/*
* Mount filesystems
*/
#ifdef REMOUNT_ROOTFS_RW
system("/bin/mount -n -o remount,rw /");
#endif
umask(0);
/*
* Parse configuration file
*/
@@ -285,26 +295,19 @@ int main()
continue;
}
if (MATCH_CMD(line, "mountdev", x)) {
mountdev = 1;
mount("none", "/dev", "tmpfs", 0, "mode=0755");
continue;
}
if (MATCH_CMD(line, "mknod ", x)) {
strcpy(cmd, "/bin/mknod ");
build_cmd(cmd, x, CMD_SIZE);
system(cmd);
continue;
}
}
fclose(f);
}
setsid();
/*
* Mount filesystems
*/
#ifdef REMOUNT_ROOTFS_RW
system("/bin/mount -n -o remount,rw /");
#endif
umask(0);
if (mountdev)
mount("none", "/dev", "tmpfs", 0, "mode=0755");
#ifdef MAKE_DEVICES
mkdir("/dev/shm", 0755);
mkdir("/dev/pts", 0755);