configure: Remove --enable-rw-rootfs detect using /etc/fstab instead

This patch removes the --enable-rw-rootfs build flag.  Like OpenRC we
now check /etc/fstab instad; if `/` is listed *and* doesn't have the
`ro` flag set, we remount / read-write.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson committed 2020-04-22 20:08:52 +02:00
1 parent 7c8b0df720
commit aa08221666
7 files changed
+30 -23

No files matched your search

+25 -5
View File
@@ -433,7 +433,7 @@ int main(int argc, char *argv[])
*/
makedir("/dev/shm", 0755);
if (!fismnt("/dev/shm") && !ismnt("/etc/fstab", "/dev/shm"))
mount("shm", "/dev/shm", "tmpfs", 0, NULL);
mount("shm", "/dev/shm", "tmpfs", 0, "mode=0777");
/*
* New tmpfs based /run for volatile runtime data
@@ -498,10 +498,30 @@ int main(int argc, char *argv[])
* Mount filesystems
*/
if (!rescue) {
#ifdef REMOUNT_ROOTFS
run("mount -n -o remount,rw /");
#endif
#ifdef SYSROOT
#ifndef SYSROOT
/*
* Remount / read-write if it exists in fstab is not 'ro'.
* This is what the Debian sysv initscripts does.
*/
if (setfsent()) {
struct fstab *fs;
while ((fs = getfsent())) {
if (strcmp(fs->fs_file, "/"))
continue;
if (strcmp(fs->fs_type, "ro"))
run_interactive("mount -n -o remount,rw /", "Remounting / as read-write");
break;
}
endfsent();
}
#else
/*
* XXX: Untested, in the initramfs age we should
* probably use switch_root instead.
*/
mount(SYSROOT, "/", NULL, MS_MOVE, NULL);
#endif
}