+[[ $machine_id_l ]] && machine_id="$machine_id_l"
+
+if ! [[ $outfile ]]; then
+ if [[ $machine_id != "no" ]]; then
+ [[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
+ fi
+
+ if [[ $uefi == "yes" ]]; then
+ BUILD_ID=$(cat /etc/os-release /usr/lib/os-release \
+ | while read -r line || [[ $line ]]; do \
+ [[ $line =~ BUILD_ID\=* ]] && eval "$line" && echo "$BUILD_ID" && break; \
+ done)
+ if [[ -d /efi ]] && mountpoint -q /efi; then
+ efidir=/efi
+ else
+ efidir=/boot/EFI
+ if [[ -d /boot/efi/EFI ]] && mountpoint -q /boot/efi; then
+ efidir=/boot/efi/EFI
+ fi
+ fi
+ mkdir -p "$efidir/Linux"
+ outfile="$efidir/Linux/linux-$kernel${MACHINE_ID:+-${MACHINE_ID}}${BUILD_ID:+-${BUILD_ID}}.efi"
+ else
+ if [[ $MACHINE_ID ]] && ( [[ -d /boot/${MACHINE_ID} ]] || [[ -L /boot/${MACHINE_ID} ]] ); then
+ outfile="/boot/${MACHINE_ID}/$kernel/initrd"
+ else
+ outfile="/boot/initramfs-$kernel.img"
+ fi
+ fi
+fi