Provisory new -e pseudo path --interval:appened_partition_N:all::
This commit is contained in:
@ -25,10 +25,19 @@ echo >&2
|
||||
# export CPPFLAGS="-DLibisofs_mjg_boot_for_grub2"
|
||||
# ./configure && make clean && make
|
||||
#
|
||||
# The mode "mbr_only" implements an alternative fully UEFI compliant layout
|
||||
# which does not produce GTP, HFS+, and APM.
|
||||
# It is supposed to work with any unmodified xorriso >= 1.3.2
|
||||
# The mode "mbr_only" implements an alternative layout according to UEFI 2.4,
|
||||
# section 2.5.1 and table 16. No GTP, HFS+, or APM.
|
||||
#
|
||||
# The mode "mbr_hfs" is like "mbr_only" but with HFS+ mentioned in APM.
|
||||
# It is still compliant to UEFI with no potentially deceiving GPT.
|
||||
#
|
||||
# These modes avoid duplicate storing of the EFI system partition "efi.img"
|
||||
# by xorrisofs option -e "--interval:appended_partition_${partno}:all::"
|
||||
# which is new to xorriso-1.4.3 with timestamp after 2015.12.30.175951.
|
||||
# If "_copy" is appended to the mode name, then the file /efi.img will
|
||||
# appear in the ISO 9660 filesystem and traditional -e "/efi.img" is used.
|
||||
#
|
||||
# "mbr_only_copy" is supposed to work with unmodified xorriso >= 1.3.2
|
||||
|
||||
#
|
||||
# Variation settings
|
||||
@ -37,9 +46,11 @@ echo >&2
|
||||
# default settings:
|
||||
|
||||
# Manipulation mode:
|
||||
# "mjg" = ESP in MBR+GPT+APM, with HFS+
|
||||
# "mbr_only" = ESP in MBR, without HFS+
|
||||
# "original" = pass arguments unchanged
|
||||
# "mjg" = ESP in MBR+GPT+APM, with HFS+
|
||||
# "mbr_only" = ESP in MBR, without HFS+
|
||||
# "mbr_hfs" = ESP in MBR, HFS+ in APM
|
||||
# $mode"_copy" = one of above modes, ESP in ISO and as appended partition
|
||||
# "original" = pass arguments unchanged
|
||||
mode="mjg"
|
||||
if test -n "$MKRESCUE_SED_MODE"
|
||||
then
|
||||
@ -101,6 +112,13 @@ fi
|
||||
# Do the work
|
||||
#
|
||||
|
||||
# grub-mkrescue inquires features by running these arguments
|
||||
if test "$*" = "-as mkisofs -help"
|
||||
then
|
||||
"$xorriso" "$@"
|
||||
exit $?
|
||||
fi
|
||||
|
||||
echo "frontend/grub-mkrescue-sed.sh mode: $mode" >&2
|
||||
echo >&2
|
||||
|
||||
@ -118,7 +136,7 @@ then
|
||||
fi
|
||||
|
||||
# Look for the name of the /tmp directory with the GRUB2 files.
|
||||
# It is the next argument after -r.
|
||||
# It is the next argument after -r. But as default accept any /tmp/grub.*
|
||||
next_is_dir=0
|
||||
dir="."
|
||||
for i in "$@"
|
||||
@ -129,7 +147,16 @@ do
|
||||
elif test $next_is_dir = 1
|
||||
then
|
||||
next_is_dir=0
|
||||
dir="$i"
|
||||
if echo "$i" | grep '^/tmp/grub.' >/dev/null 2>&1
|
||||
then
|
||||
test -d "$i" && dir="$i"
|
||||
fi
|
||||
elif test "$dir" = "."
|
||||
then
|
||||
if echo "$i" | grep '^/tmp/grub.' >/dev/null 2>&1
|
||||
then
|
||||
test -d "$i" && dir="$i"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
@ -139,7 +166,19 @@ then
|
||||
find "$dir"
|
||||
fi
|
||||
|
||||
efi_tmp_name=
|
||||
if test x"$mode" = xmjg
|
||||
then
|
||||
# Exchange arguments for the experimental GRUB2 mjg layout
|
||||
efi_tmp_name=grub-mkrescue-sed-efi-img.$$
|
||||
mv "$dir"/efi.img /tmp/$efi_tmp_name
|
||||
x=$(echo " $*" | sed \
|
||||
-e "s/-efi-boot-part --efi-boot-image/-no-pad -append_partition $partno 0xef \/tmp\/$efi_tmp_name/" \
|
||||
-e "s/--efi-boot efi\.img/-eltorito-alt-boot -e --interval:appended_partition_${partno}:all:: -no-emul-boot -isohybrid-gpt-basdat/" \
|
||||
-e "s/--protective-msdos-label/$protective/" \
|
||||
)
|
||||
|
||||
elif test x"$mode" = xmjg_copy
|
||||
then
|
||||
# Exchange arguments for the experimental GRUB2 mjg layout
|
||||
x=$(echo " $*" | sed \
|
||||
@ -149,6 +188,18 @@ then
|
||||
)
|
||||
|
||||
elif test x"$mode" = xmbr_only
|
||||
then
|
||||
# Exchange arguments for no-HFS MBR-only layout
|
||||
efi_tmp_name=grub-mkrescue-sed-efi-img.$$
|
||||
mv "$dir"/efi.img /tmp/$efi_tmp_name
|
||||
x=$(echo " $*" | sed \
|
||||
-e "s/-efi-boot-part --efi-boot-image/-no-pad -append_partition 2 0xef \/tmp\/$efi_tmp_name/" \
|
||||
-e "s/--efi-boot efi\.img/-eltorito-alt-boot -e --interval:appended_partition_2:all:: -no-emul-boot/" \
|
||||
-e "s/-hfsplus .*CoreServices\/boot.efi//" \
|
||||
-e "s/--protective-msdos-label/$protective/" \
|
||||
)
|
||||
|
||||
elif test x"$mode" = xmbr_only_copy
|
||||
then
|
||||
# Exchange arguments for no-HFS MBR-only layout
|
||||
x=$(echo " $*" | sed \
|
||||
@ -157,6 +208,25 @@ then
|
||||
-e "s/--protective-msdos-label/$protective/" \
|
||||
)
|
||||
|
||||
elif test x"$mode" = xmbr_hfs
|
||||
then
|
||||
# Exchange arguments for MBR and HFS+ layout
|
||||
efi_tmp_name=grub-mkrescue-sed-efi-img.$$
|
||||
mv "$dir"/efi.img /tmp/$efi_tmp_name
|
||||
x=$(echo " $*" | sed \
|
||||
-e "s/-efi-boot-part --efi-boot-image/-no-pad -append_partition 2 0xef \/tmp\/$efi_tmp_name/" \
|
||||
-e "s/--efi-boot efi\.img/-eltorito-alt-boot -e --interval:appended_partition_2:all:: -no-emul-boot/" \
|
||||
-e "s/--protective-msdos-label/$protective/" \
|
||||
)
|
||||
|
||||
elif test x"$mode" = xmbr_only_copy
|
||||
then
|
||||
# Exchange arguments for MBR and HFS+ layout
|
||||
x=$(echo " $*" | sed \
|
||||
-e "s/-efi-boot-part --efi-boot-image/-no-pad -append_partition 2 0xef \/tmp\/$(basename "$dir")\/efi.img/" \
|
||||
-e "s/--protective-msdos-label/$protective/" \
|
||||
)
|
||||
|
||||
elif test x"$mode" = xoriginal
|
||||
then
|
||||
# Pass arguments unchanged
|
||||
@ -178,4 +248,13 @@ fi
|
||||
|
||||
# Run xorriso binary with the converted arguments
|
||||
"$xorriso" $MKRESCUE_SED_XORRISO_ARGS $x
|
||||
ret=$?
|
||||
|
||||
# Move back the ESP if it was separated
|
||||
if test -n "$efi_tmp_name" -a -e /tmp/$efi_tmp_name
|
||||
then
|
||||
mv /tmp/$efi_tmp_name "$dir"/efi.img
|
||||
fi
|
||||
|
||||
exit $ret
|
||||
|
||||
|
Reference in New Issue
Block a user