]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
chore(rootfs-block, usrmount): align systemd and non-systemd initramfs
authorJo Zzsi <jozzsicsataban@gmail.com>
Sun, 7 Sep 2025 01:36:34 +0000 (21:36 -0400)
committerLaszlo <laszlo.gombos@gmail.com>
Sat, 13 Sep 2025 13:49:19 +0000 (09:49 -0400)
`rootfs-block/mount-root.sh` and `srmount/mount-usr.sh ` are only
included in the initramfs if systemd is _not_ included.

`systemd` does not poke into `NEWROOT` to determine fsck options,
which seems like a good idea.

Let's do the same for non-systemd initramfs. Lot of the related path
 - e.g. `/etc/sysconfig/autofsck` are distribution specific anyways.

modules.d/74rootfs-block/mount-root.sh
modules.d/77usrmount/mount-usr.sh

index 48687f66f8e7643ea64cf2b09d47180b9901917f..97c0c7f5de00486dc366d6ad7fda72e06626d4fc 100755 (executable)
@@ -27,36 +27,11 @@ mount_root() {
     done
 
     fsckoptions=
-    if [ -f "$NEWROOT"/etc/sysconfig/readonly-root ]; then
-        # shellcheck disable=SC1090
-        . "$NEWROOT"/etc/sysconfig/readonly-root
-    fi
-
-    if [ -f "$NEWROOT"/fastboot ]; then
-        fastboot=yes
-    fi
 
     if ! getargbool 0 rd.skipfsck; then
-        if [ -f "$NEWROOT"/fsckoptions ]; then
-            read -r fsckoptions < "$NEWROOT"/fsckoptions
-        fi
 
-        if [ -f "$NEWROOT"/forcefsck ] || getargbool 0 forcefsck; then
+        if getargbool 0 forcefsck; then
             fsckoptions="-f $fsckoptions"
-        elif [ -f "$NEWROOT"/.autofsck ]; then
-            # shellcheck disable=SC1090
-            [ -f "$NEWROOT"/etc/sysconfig/autofsck ] \
-                && . "$NEWROOT"/etc/sysconfig/autofsck
-            if [ "$AUTOFSCK_DEF_CHECK" = "yes" ]; then
-                AUTOFSCK_OPT="$AUTOFSCK_OPT -f"
-            fi
-            if [ -n "$AUTOFSCK_SINGLEUSER" ]; then
-                warn "*** Warning -- the system did not shut down cleanly. "
-                warn "*** Dropping you to a shell; the system will continue"
-                warn "*** when you leave the shell."
-                emergency_shell
-            fi
-            fsckoptions="$AUTOFSCK_OPT $fsckoptions"
         fi
     fi
 
@@ -110,11 +85,6 @@ mount_root() {
         info "Remounting ${root#block:} with -o ${rflags}"
         mount -o remount "$NEWROOT" 2>&1 | vinfo
     fi
-
-    if ! getargbool 0 rd.skipfsck; then
-        [ -f "$NEWROOT"/forcefsck ] && rm -f -- "$NEWROOT"/forcefsck 2> /dev/null
-        [ -f "$NEWROOT"/.autofsck ] && rm -f -- "$NEWROOT"/.autofsck 2> /dev/null
-    fi
 }
 
 if [ -n "$root" ] && [ -z "${root%%block:*}" ]; then
index 1de51bef3d76896b8b8a47095156c3e51a500f60..ff9f13a3dabd781e84bda29c2071df2a00e814cd 100755 (executable)
@@ -25,25 +25,8 @@ fsck_usr() {
     local _fsopts="$3"
     local _fsckoptions
 
-    if [ -f "$NEWROOT"/fsckoptions ]; then
-        read -r _fsckoptions < "$NEWROOT"/fsckoptions
-    fi
-
-    if [ -f "$NEWROOT"/forcefsck ] || getargbool 0 forcefsck; then
+    if getargbool 0 forcefsck; then
         _fsckoptions="-f $_fsckoptions"
-    elif [ -f "$NEWROOT"/.autofsck ]; then
-        # shellcheck disable=SC1090
-        [ -f "$NEWROOT"/etc/sysconfig/autofsck ] && . "$NEWROOT"/etc/sysconfig/autofsck
-        if [ "$AUTOFSCK_DEF_CHECK" = "yes" ]; then
-            AUTOFSCK_OPT="$AUTOFSCK_OPT -f"
-        fi
-        if [ -n "$AUTOFSCK_SINGLEUSER" ]; then
-            warn "*** Warning -- the system did not shut down cleanly. "
-            warn "*** Dropping you to a shell; the system will continue"
-            warn "*** when you leave the shell."
-            emergency_shell
-        fi
-        _fsckoptions="$AUTOFSCK_OPT $_fsckoptions"
     fi
 
     fsck_single "$_dev" "$_fs" "$_fsopts" "$_fsckoptions"