From e8135dde3779d85a05dbe1ca65766a01dec5e820 Mon Sep 17 00:00:00 2001
From: Andreas Loibl <andreas@andreas-loibl.de>
Date: Sun, 25 Aug 2013 10:13:45 +0200
Subject: added xorriso-support

---
 auto/functions/livebuild-hacks | 17 ++++++++++++++++-
 isohybrid-acritox              |  9 +++++++--
 2 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/auto/functions/livebuild-hacks b/auto/functions/livebuild-hacks
index 3fc2fac..bfe1ade 100644
--- a/auto/functions/livebuild-hacks
+++ b/auto/functions/livebuild-hacks
@@ -10,7 +10,22 @@ if [ "$current_script" = "binary_iso" ]; then
 	{
 		if [ -f config/binary_iso/isoimage.sort ]
 		then
-			echo " -sort isoimage.sort"
+            case "${LB_PARENT_DISTRIBUTION}" in
+                squeeze) echo " -sort isoimage.sort";; # genisoimage
+                *) # xorriso - emulate the "-sort" argument of genisoimage:
+                    set -x
+                    echo " --boot-catalog-hide" $( 
+                        while read pattern weight
+                        do
+                            for file in $pattern
+                            do
+                                [ -e "$file" ] && echo --sort-weight "$(echo "100+0$weight" | bc)" "$file"
+                            done
+                        done < config/binary_iso/isoimage.sort | sed 's/ binary/ /')
+                    set +x
+                    ;;
+                    # echo ' --boot-catalog-hide $(while read pattern weight; do for file in $pattern; do [ -e "$file" ] && echo --sort-weight "$(echo "100+0$weight" | bc)" "$(echo "$file"|sed 's/^binary//')"; done; done < isoimage.sort)';;
+            esac
 
 			case "${LB_BUILD_WITH_CHROOT}" in
 				true)
diff --git a/isohybrid-acritox b/isohybrid-acritox
index 42abe6c..23f53ee 100755
--- a/isohybrid-acritox
+++ b/isohybrid-acritox
@@ -465,8 +465,13 @@ do
 				$bytes = unpack("C", $bytes) - 1;
 				printf("SUSP Entry - %u bytes (0x%X)\n", $bytes+1, $bytes+1) if($debug);
 			} while $bytes > 0;
-			$sector_blk++;
-			seek(FIMG, $iso_pos+$first_sector_blk*$bs+$sector_blk*$bs, SEEK_SET) or die "$0: $file: $!\n";
+            do {
+                $sector_blk++;
+                seek(FIMG, $iso_pos+$first_sector_blk*$bs+$sector_blk*$bs, SEEK_SET) or die "$0: $file: $!\n";
+                read(FIMG, $sua_head, 4) > 0 or break;
+                seek(FIMG, tell(FIMG)-4, SEEK_SET) or die "$0: $file: $!\n";
+                ($sig, $len, $version) = unpack("a[2]CC", $sua_head);
+            } while($sig eq "ER"); # skip ER(Extensions Reference)-SUA, xorriso intersperses this somehow
 			printf("\ndirectory entry at 0x%X:\n", tell(FIMG)) if($debug);
 			read(FIMG, $bytes, 1) > 0 or break;
 			$bytes = unpack("C", $bytes) - 1;
-- 
cgit v1.0