From 039018718901e2aa5beecc5d395c1cca0babcf25 Mon Sep 17 00:00:00 2001 From: Andreas Loibl Date: Tue, 22 May 2012 09:42:11 +0200 Subject: updated iso-combine script --- combine_iso.bash | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 69 insertions(+), 7 deletions(-) diff --git a/combine_iso.bash b/combine_iso.bash index 2f70813..4f97991 100755 --- a/combine_iso.bash +++ b/combine_iso.bash @@ -4,6 +4,8 @@ wd=tmp iso=1 isos=() +sfx=() +bit=() cleanup () { @@ -72,11 +74,28 @@ esac cd "$wd" mkdir out -for src in iso*/ +group64= +group32= +for i in $(seq $[iso-1]) do - grep -q amd64 "$src/.disk/info" && bit=64 || bit=32 - rsync -Ha --ignore-existing "$src" out/ - mv out/live out/live$bit || : + echo "Copying ${isos[$i]}..." + rsync -Ha --ignore-existing "iso$i/" out/ + if grep -q amd64 "iso$i/.disk/info"; then + bit[$i]=64 + group64+=" $i" + else + bit[$i]=32 + group32+=" $i" + fi + [ $iso -gt 3 ] && suffix=$i || suffix=${bit[$i]} + while read -e -p "rename live-folder to: live" -i "$suffix" suffix + do + [ ! -e out/live$suffix ] && break + echo "Error! live$suffix already exists!" + done + sfx[$i]="$suffix" + sfx[$i]="$suffix" + mv out/live out/live$suffix || : done # we need only one memtest @@ -84,22 +103,65 @@ mkdir out/live mv "$(ls -t out/live*/memtest* | tail -n1)" out/live/ rm -f out/live?*/memtest* +rm -f out/md5sum.txt out/boot.catalog + # generate grub.cfg { read head; read block; read tail; } < <(cat out/boot/grub/grub.cfg | tr '\n' '\a' | sed 's/\a#####\a/\n/g') -entry() { tr '\a' '\n' <<<"$block" | sed "s/\/live\/\(vmlinuz[^ ]*\)/\/live$1\/\1 live-media-path=live$1/g; s/\/live\//\/live$1\//g; s/Kanotix\(32\|64\|\)/Kanotix$1/g"; } +entry() { tr '\a' '\n' <<<"$block" | sed "s/\/live\/\(vmlinuz[^ ]*\)/\/live${sfx[$1]}\/\1 live-media-path=live${sfx[$1]}/g; s/\/live\//\/live${sfx[$1]}\//g; s/Kanotix\(32\|64\|\)/Kanotix${bit[$1]}/g"; } tr '\a' '\n' <<<"$head" > out/boot/grub/grub.cfg + +if [ "$group64" ]; then cat <> out/boot/grub/grub.cfg + +# 64bit ################################ if cpuid -l ; then if [ \$efi_arch != x86 ] ; then -$(entry 64) +eof +for i in $group64 +do +entry $i >> out/boot/grub/grub.cfg +done +cat <> out/boot/grub/grub.cfg fi fi +eof +fi + +if [ "$group32" ]; then +cat <> out/boot/grub/grub.cfg + +# 32bit ################################ if [ \$efi_arch != x64 ] ; then -$(entry 32) +eof +for i in $group32 +do +entry $i >> out/boot/grub/grub.cfg +done +cat <> out/boot/grub/grub.cfg fi eof +fi + tr '\a' '\n' <<<"$tail" >> out/boot/grub/grub.cfg +vim out/boot/grub/grub.cfg + wget -qO- "http://git.acritox.com/kanotix/plain/config/binary_iso/isoimage.sort" | sed "s/^binary/out$/" > isoimage.sort + +echo "Generating md5sums.txt..." +cd out +find . -type f \ + \! -path './isolinux/isolinux.bin' \ + \! -path './boot/grub/stage2_eltorito' \ + \! -path './boot/grub/grub_eltorito' \ + \! -path './boot.catalog' \ + \! -path './boot.isohybrid' \ + \! -path './md5sum.txt' \ + \! -path './sha1sum.txt' \ + \! -path './sha256sum.txt' \ +-print0 | sort -z | xargs -0 md5sum > md5sum.txt +cd .. + genisoimage -J -l -cache-inodes -allow-multidot -A "$opt_appid" -publisher "$opt_pubid" -p "$opt_preid" -V "$opt_volid" -no-emul-boot -boot-load-size 4 -boot-info-table -r -b boot/grub/grub_eltorito -sort isoimage.sort -o "$out" out cd - + -- cgit v1.0