]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
perf(base): /etc/initrd-release is only for systemd
authorJo Zzsi <jozzsicsataban@gmail.com>
Fri, 13 Sep 2024 18:35:22 +0000 (14:35 -0400)
committerLaszlo <laszlo.gombos@gmail.com>
Thu, 17 Oct 2024 12:40:38 +0000 (08:40 -0400)
modules.d/98dracut-systemd/module-setup.sh
modules.d/99base/module-setup.sh

index 724b00b1d413a74aa98d1228edfbcc5daa8cdb44..93c0bfa737b80c299d546fb0b59f5d2502abdd96 100755 (executable)
@@ -64,4 +64,41 @@ install() {
     inst_simple "$moddir/dracut-tmpfiles.conf" "$tmpfilesdir/dracut-tmpfiles.conf"
 
     inst_multiple sulogin
+
+    [ -e "${initdir}/usr/lib" ] || mkdir -m 0755 -p "${initdir}"/usr/lib
+
+    local VERSION=""
+    local PRETTY_NAME=""
+    # Derive an os-release file from the host, if it exists
+    if [[ -e $dracutsysrootdir/etc/os-release ]]; then
+        # shellcheck disable=SC1090
+        . "$dracutsysrootdir"/etc/os-release
+        grep -hE -ve '^VERSION=' -ve '^PRETTY_NAME' "$dracutsysrootdir"/etc/os-release > "${initdir}"/usr/lib/initrd-release
+        [[ -n ${VERSION} ]] && VERSION+=" "
+        [[ -n ${PRETTY_NAME} ]] && PRETTY_NAME+=" "
+    else
+        # Fall back to synthesizing one, since dracut is presently used
+        # on non-systemd systems as well.
+        {
+            echo "NAME=dracut"
+            echo "ID=dracut"
+            echo "VERSION_ID=\"$DRACUT_VERSION\""
+            echo 'ANSI_COLOR="0;34"'
+        } > "${initdir}"/usr/lib/initrd-release
+    fi
+    VERSION+="dracut-$DRACUT_VERSION"
+    PRETTY_NAME+="dracut-$DRACUT_VERSION (Initramfs)"
+    {
+        echo "VERSION=\"$VERSION\""
+        echo "PRETTY_NAME=\"$PRETTY_NAME\""
+        # This addition is relatively new, intended to allow software
+        # to easily detect the dracut version if need be without
+        # having it mixed in with the real underlying OS version.
+        echo "DRACUT_VERSION=\"${DRACUT_VERSION}\""
+    } >> "$initdir"/usr/lib/initrd-release
+    echo "dracut-$DRACUT_VERSION" > "$initdir/lib/dracut/dracut-$DRACUT_VERSION"
+    ln -sf ../usr/lib/initrd-release "$initdir"/etc/initrd-release
+    ln -sf initrd-release "$initdir"/usr/lib/os-release
+    ln -sf initrd-release "$initdir"/etc/os-release
+
 }
index 8a4b17c46047f425c0a830e290aa58c09af85a14..723cb9f248ba1c0510cc88b74212ad2dbd0dac87 100755 (executable)
@@ -61,42 +61,6 @@ install() {
         echo ro >> "${initdir}/etc/cmdline.d/base.conf"
     fi
 
-    [ -e "${initdir}/usr/lib" ] || mkdir -m 0755 -p "${initdir}"/usr/lib
-
-    local VERSION=""
-    local PRETTY_NAME=""
-    # Derive an os-release file from the host, if it exists
-    if [[ -e $dracutsysrootdir/etc/os-release ]]; then
-        # shellcheck disable=SC1090
-        . "$dracutsysrootdir"/etc/os-release
-        grep -hE -ve '^VERSION=' -ve '^PRETTY_NAME' "$dracutsysrootdir"/etc/os-release > "${initdir}"/usr/lib/initrd-release
-        [[ -n ${VERSION} ]] && VERSION+=" "
-        [[ -n ${PRETTY_NAME} ]] && PRETTY_NAME+=" "
-    else
-        # Fall back to synthesizing one, since dracut is presently used
-        # on non-systemd systems as well.
-        {
-            echo "NAME=dracut"
-            echo "ID=dracut"
-            echo "VERSION_ID=\"$DRACUT_VERSION\""
-            echo 'ANSI_COLOR="0;34"'
-        } > "${initdir}"/usr/lib/initrd-release
-    fi
-    VERSION+="dracut-$DRACUT_VERSION"
-    PRETTY_NAME+="dracut-$DRACUT_VERSION (Initramfs)"
-    {
-        echo "VERSION=\"$VERSION\""
-        echo "PRETTY_NAME=\"$PRETTY_NAME\""
-        # This addition is relatively new, intended to allow software
-        # to easily detect the dracut version if need be without
-        # having it mixed in with the real underlying OS version.
-        echo "DRACUT_VERSION=\"${DRACUT_VERSION}\""
-    } >> "$initdir"/usr/lib/initrd-release
-    echo "dracut-$DRACUT_VERSION" > "$initdir/lib/dracut/dracut-$DRACUT_VERSION"
-    ln -sf ../usr/lib/initrd-release "$initdir"/etc/initrd-release
-    ln -sf initrd-release "$initdir"/usr/lib/os-release
-    ln -sf initrd-release "$initdir"/etc/os-release
-
     ## save host_devs which we need bring up
     if [[ $hostonly_cmdline == "yes" ]]; then
         if [[ -n ${host_devs[*]} ]]; then