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
2020-04-22 20:08:52 +02:00
parent 7c8b0df720
commit aa08221666
7 changed files with 30 additions and 23 deletions
-8
View File
@@ -61,10 +61,6 @@ AC_ARG_ENABLE(auto_reload,
AS_HELP_STRING([--enable-auto-reload], [Automatic reload on any .conf change]),,[ AS_HELP_STRING([--enable-auto-reload], [Automatic reload on any .conf change]),,[
enable_auto_reload=no]) enable_auto_reload=no])
AC_ARG_ENABLE(rw-rootfs,
AS_HELP_STRING([--enable-rw-rootfs], [Remount / R/W at boot, usually not for embedded]),,[
enable_rw_rootfs=no])
AC_ARG_ENABLE(progress, AC_ARG_ENABLE(progress,
AS_HELP_STRING([--enable-progress], [Modern progress display at bootup]),,[ AS_HELP_STRING([--enable-progress], [Modern progress display at bootup]),,[
enable_progress=no]) enable_progress=no])
@@ -164,9 +160,6 @@ AS_IF([test "x$enable_fallback_shell" = "xyes"], [
AS_IF([test "x$enable_auto_reload" = "xyes"], [ AS_IF([test "x$enable_auto_reload" = "xyes"], [
AC_DEFINE(AUTO_RELOAD, 1, [Finit automatically does `initctl reload` on any .conf change])]) AC_DEFINE(AUTO_RELOAD, 1, [Finit automatically does `initctl reload` on any .conf change])])
AS_IF([test "x$enable_rw_rootfs" = "xyes"], [
AC_DEFINE(REMOUNT_ROOTFS, 1, [Remount / as rw at boot])])
AS_IF([test "x$enable_progress" = "xyes"], [ AS_IF([test "x$enable_progress" = "xyes"], [
AC_DEFINE(PROGRESS_STYLE, 2, [Modern bootup messages, systemd inspired])]) AC_DEFINE(PROGRESS_STYLE, 2, [Modern bootup messages, systemd inspired])])
@@ -301,7 +294,6 @@ Optional features:
Scripting tool logit..: $enable_logit Scripting tool logit..: $enable_logit
Emergency shell.......: $enable_emergency_shell Emergency shell.......: $enable_emergency_shell
Fallback shell........: $enable_fallback_shell Fallback shell........: $enable_fallback_shell
Remount / RW at boot..: $enable_rw_rootfs
Modern progress.......: $enable_progress Modern progress.......: $enable_progress
Classic progress......: $enable_progress_classic Classic progress......: $enable_progress_classic
Default console dev...: $console Default console dev...: $console
+1 -1
View File
@@ -14,7 +14,7 @@ fi
# The plugins are optional, but you may need D-Bus and X11 if you want # The plugins are optional, but you may need D-Bus and X11 if you want
# to run X-Window, the other configure flags are however required. # to run X-Window, the other configure flags are however required.
PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig:/usr/local/lib/pkgconfig ./configure \ PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig:/usr/local/lib/pkgconfig ./configure \
--enable-rw-rootfs --enable-progress \ --enable-progress \
--enable-dbus-plugin --enable-x11-common-plugin \ --enable-dbus-plugin --enable-x11-common-plugin \
--enable-alsa-utils-plugin --enable-inetd-echo-plugin \ --enable-alsa-utils-plugin --enable-inetd-echo-plugin \
--enable-inetd-chargen-plugin --enable-inetd-daytime-plugin \ --enable-inetd-chargen-plugin --enable-inetd-daytime-plugin \
+1 -1
View File
@@ -22,7 +22,7 @@ echo
# The plugins are optional, but you may need D-Bus and X11 if you want # The plugins are optional, but you may need D-Bus and X11 if you want
# to run X-Window, the other configure flags are however required. # to run X-Window, the other configure flags are however required.
./configure \ ./configure \
--enable-rw-rootfs --enable-progress \ --enable-progress \
--enable-dbus-plugin --enable-x11-common-plugin \ --enable-dbus-plugin --enable-x11-common-plugin \
--enable-alsa-utils-plugin --enable-inetd-echo-plugin \ --enable-alsa-utils-plugin --enable-inetd-echo-plugin \
--enable-inetd-chargen-plugin --enable-inetd-daytime-plugin \ --enable-inetd-chargen-plugin --enable-inetd-daytime-plugin \
+1 -1
View File
@@ -14,7 +14,7 @@ fi
# The plugins are optional, but you may need D-Bus and X11 if you want # The plugins are optional, but you may need D-Bus and X11 if you want
# to run X-Window, the other configure flags are however required. # to run X-Window, the other configure flags are however required.
PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig:/usr/local/lib/pkgconfig ./configure \ PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig:/usr/local/lib/pkgconfig ./configure \
--enable-rw-rootfs --enable-progress \ --enable-progress \
--enable-dbus-plugin --enable-x11-common-plugin \ --enable-dbus-plugin --enable-x11-common-plugin \
--enable-alsa-utils-plugin --enable-inetd-echo-plugin \ --enable-alsa-utils-plugin --enable-inetd-echo-plugin \
--enable-inetd-chargen-plugin --enable-inetd-daytime-plugin \ --enable-inetd-chargen-plugin --enable-inetd-daytime-plugin \
+1 -1
View File
@@ -12,7 +12,7 @@ Bootstrap
9. Parse `/etc/finit.conf` and all `/etc/finit.d/*.conf` files 9. Parse `/etc/finit.conf` and all `/etc/finit.d/*.conf` files
10. Start built-in watchdog, if enabled 10. Start built-in watchdog, if enabled
11. Set hostname 11. Set hostname
12. Pivot root, or remount `/` read-write, depending on system type 12. Remount `/` read-write if `/` is listed in `/etc/fstab` without `ro`
13. Call 1st level hooks, `HOOK_ROOTFS_UP` 13. Call 1st level hooks, `HOOK_ROOTFS_UP`
14. Mount all file systems listed in `/etc/fstab` and swap, if available 14. Mount all file systems listed in `/etc/fstab` and swap, if available
15. Enable SysV init signals 15. Enable SysV init signals
+1 -6
View File
@@ -40,11 +40,6 @@ Below are a few of the main switches to configure:
* `--disable-inetd`: Disable the built-in inetd server. * `--disable-inetd`: Disable the built-in inetd server.
* `--enable-rw-rootfs`: Most desktop and server systems boot with the
root file stystem read-only. With this setting Finit will remount it
as read-write early at boot so the `bootmisc.so` plugin can run.
Usually not needed on embedded systems.
* `--enable-static`: Build Finit statically. The plugins will be * `--enable-static`: Build Finit statically. The plugins will be
built-ins (.o files) and all external libraries, except the C library built-ins (.o files) and all external libraries, except the C library
will be linked statically. will be linked statically.
@@ -73,7 +68,7 @@ First, unpack the archive:
Then configure, build and install: Then configure, build and install:
```shell ```shell
$ ./configure --enable-rw-rootfs --enable-inetd-echo-plugin \ $ ./configure --enable-inetd-echo-plugin \
--enable-inetd-chargen-plugin --enable-inetd-daytime-plugin \ --enable-inetd-chargen-plugin --enable-inetd-daytime-plugin \
--enable-inetd-discard-plugin --enable-inetd-time-plugin \ --enable-inetd-discard-plugin --enable-inetd-time-plugin \
--with-heading="Alpine Linux 3.4" --with-hostname=alpine --with-heading="Alpine Linux 3.4" --with-hostname=alpine
+25 -5
View File
@@ -433,7 +433,7 @@ int main(int argc, char *argv[])
*/ */
makedir("/dev/shm", 0755); makedir("/dev/shm", 0755);
if (!fismnt("/dev/shm") && !ismnt("/etc/fstab", "/dev/shm")) 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 * New tmpfs based /run for volatile runtime data
@@ -498,10 +498,30 @@ int main(int argc, char *argv[])
* Mount filesystems * Mount filesystems
*/ */
if (!rescue) { if (!rescue) {
#ifdef REMOUNT_ROOTFS #ifndef SYSROOT
run("mount -n -o remount,rw /"); /*
#endif * Remount / read-write if it exists in fstab is not 'ro'.
#ifdef SYSROOT * 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); mount(SYSROOT, "/", NULL, MS_MOVE, NULL);
#endif #endif
} }