]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
Add --uefi-output for custom output filename
authorleo-lb <lle-bout@zaclys.net>
Tue, 8 Sep 2020 11:05:05 +0000 (13:05 +0200)
committerDaniel Molkentin <daniel@molkentin.de>
Tue, 24 Nov 2020 18:38:30 +0000 (19:38 +0100)
Closes #921

dracut-bash-completion.sh
dracut.8.asc
dracut.conf.5.asc
dracut.sh

index 913471017956b47d2561ee88b70de6715f5aa0f2..3104c3ebd23ac93454a7a04eda811f3e0bac51cf 100644 (file)
@@ -38,7 +38,7 @@ _dracut() {
                               --fwdir --libdirs --fscks --add-fstab --mount --device --nofscks
                               --kmoddir --conf --confdir --tmpdir --stdlog --compress --prefix
                               --kernel-cmdline --sshkey --persistent-policy --install-optional
-                              --loginstall --uefi-stub --kernel-image
+                              --loginstall --uefi-stub --kernel-image --uefi-output
                               '
         )
 
index b99019e502686a7d5354431c77347655ab082026..cc099dc25110d56b2191e230fee7f10b5b099374 100644 (file)
@@ -524,6 +524,9 @@ will not be able to boot.
     Specifies the UEFI stub loader's splash image. Requires bitmap (**.bmp**) image
     format.
 
+**--uefi-output _<FILE>_**::
+    Specifies the UEFI application output filename, uses default if not set.
+
 **--kernel-image _<FILE>_**::
     Specifies the kernel image, which to include in the UEFI executable. The default is
     _/lib/modules/<KERNEL-VERSION>/vmlinuz_ or _/boot/vmlinuz-<KERNEL-VERSION>_
@@ -674,6 +677,8 @@ David Dillow
 
 Will Woods
 
+Léo Le Bouter
+
 SEE ALSO
 --------
 *dracut.cmdline*(7) *dracut.conf*(5) *lsinitrd*(1)
index f206f2f7b66841e15c7703fd1f13d5bed392c75e..48255bdefaa634010bf7bad77dcf389a25283277 100644 (file)
@@ -209,6 +209,9 @@ provide a valid _/etc/fstab_.
 *uefi_splash_image=*"_<FILE>_"::
     Specifies the UEFI stub loader's splash image. Requires bitmap (**.bmp**) image format.
 
+*uefi_output=*"_<FILE>_"::
+    Specifies the UEFI application output filename, uses default if not set.
+
 *uefi_secureboot_cert=*"_<FILE>_", *uefi_secureboot_key=*"_<FILE>_"::
     Specifies a certificate and corresponding key, which are used to sign the created UEFI executable.
     Requires both certificate and key need to be specified and _sbsign_ to be installed.
@@ -232,6 +235,8 @@ AUTHOR
 ------
 Harald Hoyer
 
+Léo Le Bouter
+
 See Also
 --------
 *dracut*(8) *dracut.cmdline*(7)
index 0f464839703d29cadb98357795cb37aa127facde..117c84af496f41896c94f7a2e4f2f2a4f4fcb3d9 100755 (executable)
--- a/dracut.sh
+++ b/dracut.sh
@@ -241,6 +241,8 @@ Creates initial ramdisk images for preloading modules
   --uefi-splash-image [FILE]
                         Use [FILE] as a splash image when creating an UEFI
                         executable
+  --uefi-output [FILE]  Use [FILE] as output filename when creating an UEFI
+                        executable
   --kernel-image [FILE] location of the kernel image
   --regenerate-all      Regenerate all initramfs images at the default location
                         for the kernel versions found on the system
@@ -423,6 +425,7 @@ rearrange_params()
         --long uefi \
         --long uefi-stub: \
         --long uefi-splash-image: \
+        --long uefi-output: \
         --long kernel-image: \
         --long no-hostonly-i18n \
         --long hostonly-i18n \
@@ -627,6 +630,8 @@ while :; do
                        uefi_stub_l="$2";               PARMS_TO_STORE+=" '$2'"; shift;;
         --uefi-splash-image)
                        uefi_splash_image_l="$2";       PARMS_TO_STORE+=" '$2'"; shift;;
+        --uefi-output)
+                       uefi_output_l="$2";             PARMS_TO_STORE+=" '$2'"; shift;;
         --kernel-image)
                        kernel_image_l="$2";            PARMS_TO_STORE+=" '$2'"; shift;;
         --no-machineid)
@@ -811,6 +816,7 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
 [[ $loginstall_l ]] && loginstall="$loginstall_l"
 [[ $uefi_stub_l ]] && uefi_stub="$uefi_stub_l"
 [[ $uefi_splash_image_l ]] && uefi_splash_image="$uefi_splash_image_l"
+[[ $uefi_output_l ]] && uefi_output="$uefi_output_l"
 [[ $kernel_image_l ]] && kernel_image="$kernel_image_l"
 [[ $machine_id_l ]] && machine_id="$machine_id_l"
 
@@ -830,27 +836,31 @@ if ! [[ $outfile ]]; then
             exit 1
         fi
 
-        BUILD_ID=$(cat $dracutsysrootdir/etc/os-release $dracutsysrootdir/usr/lib/os-release \
-                       | while read -r line || [[ $line ]]; do \
-                       [[ $line =~ BUILD_ID\=* ]] && eval "$line" && echo "$BUILD_ID" && break; \
-                   done)
-        if [[ -z $dracutsysrootdir ]]; then
-            if [[ -d /efi ]] && mountpoint -q /efi; then
-                efidir=/efi/EFI
+        if [[ -z "$uefi_output" ]]; then
+            BUILD_ID=$(cat $dracutsysrootdir/etc/os-release $dracutsysrootdir/usr/lib/os-release \
+                           | while read -r line || [[ $line ]]; do \
+                           [[ $line =~ BUILD_ID\=* ]] && eval "$line" && echo "$BUILD_ID" && break; \
+                       done)
+            if [[ -z $dracutsysrootdir ]]; then
+                if [[ -d /efi ]] && mountpoint -q /efi; then
+                    efidir=/efi/EFI
+                else
+                    efidir=/boot/EFI
+                    if [[ -d $dracutsysrootdir/boot/efi/EFI ]]; then
+                        efidir=/boot/efi/EFI
+                    fi
+                fi
             else
                 efidir=/boot/EFI
                 if [[ -d $dracutsysrootdir/boot/efi/EFI ]]; then
                     efidir=/boot/efi/EFI
                 fi
             fi
+            mkdir -p "$dracutsysrootdir$efidir/Linux"
+            outfile="$dracutsysrootdir$efidir/Linux/linux-$kernel${MACHINE_ID:+-${MACHINE_ID}}${BUILD_ID:+-${BUILD_ID}}.efi"
         else
-            efidir=/boot/EFI
-            if [[ -d $dracutsysrootdir/boot/efi/EFI ]]; then
-                efidir=/boot/efi/EFI
-            fi
+            outfile="$uefi_output"
         fi
-        mkdir -p "$dracutsysrootdir$efidir/Linux"
-        outfile="$dracutsysrootdir$efidir/Linux/linux-$kernel${MACHINE_ID:+-${MACHINE_ID}}${BUILD_ID:+-${BUILD_ID}}.efi"
     else
         if [[ -e "$dracutsysrootdir/boot/vmlinuz-$kernel" ]]; then
             outfile="/boot/initramfs-$kernel.img"