Man-in-the-middle script to manipulate the xorriso run of grub-mkrescue

This commit is contained in:
Thomas Schmitt 2015-12-27 20:20:38 +00:00
parent febce317a6
commit 41611e5cf6
4 changed files with 103 additions and 8 deletions

View File

@ -263,6 +263,7 @@ EXTRA_DIST = \
frontend/xorriso-tcltk \ frontend/xorriso-tcltk \
frontend/sh_on_named_pipes.sh \ frontend/sh_on_named_pipes.sh \
frontend/xorriso_broker.sh \ frontend/xorriso_broker.sh \
frontend/grub-mkrescue-sed.sh \
README \ README \
AUTHORS \ AUTHORS \
CONTRIBUTORS \ CONTRIBUTORS \

86
frontend/grub-mkrescue-sed.sh Executable file
View File

@ -0,0 +1,86 @@
#!/bin/sh
# Copyright (C) 2015
# Thomas Schmitt <scdbackup@gmx.net>, 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

View File

@ -12,19 +12,25 @@
# libisofs jte libburn libisoburn # libisofs jte libburn libisoburn
# obtained according to instructions on http://libburnia-project.org. # obtained according to instructions on http://libburnia-project.org.
# #
# Produce a necessary binary
# (cd libisoburn-develop/xorriso && \
# cc -g -Wall -o unite_html_b_line unite_html_b_line.c )
#
# It creates a new directory tree # It creates a new directory tree
# xorriso-standalone # xorriso-standalone
# for building GNU xorriso. # for building GNU xorriso.
# The ./bootstrap script gets applied and a source tarball is made.
# #
# The ./bootstrap script gets applied and a source tarball # Before running this script one needs to apply autotools to libisoburn
# is made. # ./libisoburn-develop/bootstrap
# #
# From that tree can be build a binary xorriso/xorriso which at runtime # and to produce a necessary binary
# does not depend on installed libburnia libraries. # (cd libisoburn-develop/xorriso && \
# cc -g -Wall -o unite_html_b_line unite_html_b_line.c )
#
# Then run
#
# ./libisoburn-develop/xorriso/make_xorriso_standalone.sh
#
# From the emerging xorriso-standalone tree can be build a binary
# xorriso/xorriso
# which at runtime does not depend on installed libburnia libraries.
# Execute in xorriso-standalone : # Execute in xorriso-standalone :
# #
# ./configure && make # ./configure && make
@ -246,6 +252,7 @@ copy_files \
frontend/xorriso-tcltk \ frontend/xorriso-tcltk \
frontend/sh_on_named_pipes.sh \ frontend/sh_on_named_pipes.sh \
frontend/xorriso_broker.sh \ frontend/xorriso_broker.sh \
frontend/grub-mkrescue-sed.sh \
"$lone_dir"/frontend "$lone_dir"/frontend

View File

@ -343,6 +343,7 @@ EXTRA_DIST = \
frontend/xorriso-tcltk \ frontend/xorriso-tcltk \
frontend/sh_on_named_pipes.sh \ frontend/sh_on_named_pipes.sh \
frontend/xorriso_broker.sh \ frontend/xorriso_broker.sh \
frontend/grub-mkrescue-sed.sh \
libisofs/aaip-os-dummy.c \ libisofs/aaip-os-dummy.c \
libisofs/aaip-os-linux.c \ libisofs/aaip-os-linux.c \
libisofs/aaip-os-freebsd.c \ libisofs/aaip-os-freebsd.c \