#!/bin/sh # Copyright (C) 2015 # Thomas Schmitt , libburnia-project.org # Provided under BSD license: Use, modify, and distribute as you like. echo >&2 echo "frontend/grub-mkrescue-sed.sh manipulating xorriso arguments" >&2 echo >&2 # This script may be handed by its absolute path to grub-mkrescue # via option --xorriso= . E.g. # # mkdir minimal # touch minimal/empty-file.txt # grub-mkrescue -o output.iso minimal \ # --xorriso=/home/thomas/xorriso-1.4.3./frontend/grub-mkrescue-sed.sh # # It will manipulate the xorriso arguments before # they get executed by the neighboring ../../xorriso/xorriso program. # # In its current form it implements an experiment which should be # accompanied by a xorriso from # export CPPFLAGS="-DLibisofs_mjg_boot_for_grub2" # ./configure && make clean && make # Variation settings: # First argument of -append_partition partno=1 # Replacement for option --protective-msdos-label protective="--protective-msdos-label" # "yes" make the script very verbous debug=no if test "$debug" = yes then # Show arguments echo "$0" >&2 for i in "$@" do echo "|""$i""|" >&2 done fi # Look for the name of the /tmp directory with the GRUB2 files. # It is the next argument after -r. next_is_dir=0 dir="." for i in "$@" do if test x"$i" = x"-r" then next_is_dir=1 elif test $next_is_dir = 1 then next_is_dir=0 dir="$i" fi done if test "$debug" = yes then # Show files on disk find "$dir" fi # Exchange arguments for the experimental GRUB2 mjg layout x=$(echo " $*" | sed \ -e "s/-efi-boot-part --efi-boot-image/-no-pad -append_partition $partno 0xef \/tmp\/$(basename "$dir")\/efi.img/" \ -e "s/--efi-boot efi\.img/-eltorito-alt-boot -e efi.img -no-emul-boot -isohybrid-gpt-basdat/" \ -e "s/--protective-msdos-label/$protective/" \ ) if test "$debug" = yes then echo "+ converted xorriso arguments:" >&2 echo " $x" >&2 fi # Run neighboring xorriso binary with the altered arguments self_dir=$(dirname $(dirname "$0") ) "$self_dir"/xorriso/xorriso $x