[syslinux] [PATCH v2] isohybrid: user options

Luciano Miguel Ferreira Rocha strange at nsk.no-ip.org
Fri May 15 03:12:55 PDT 2009


Allow the user to define the type of partition and its number from the
command line.

The following example creates partition number 4 with type 1c (hidden
FAT32 LBA):
  isohybrid -p4 -t1c hybrid.iso

Values can be separated from options:
  isohybrid -p 1 -t 7 hybrid.iso
---
 utils/isohybrid.in |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

> Any way we could use more Unix-like options, without the = sign?

Not with just the -s option to perl, but GetOpt::Std is bundled with perl5,
anyway.

diff --git a/utils/isohybrid.in b/utils/isohybrid.in
index 83f9dc0..207f197 100644
--- a/utils/isohybrid.in
+++ b/utils/isohybrid.in
@@ -18,6 +18,13 @@
 
 use bytes;
 use Fcntl;
+use Getopt::Std;
+
+# Option parsing:
+# -p partition_number
+# -t partition_type
+# e.g.: -p4 -t 1b
+getopts('p:t:');
 
 # Use this fake geometry (zipdrive-style...)
 $h = 64; $s = 32;
@@ -135,8 +142,8 @@ $bcyl    = 0;
 $ehead   = $h-1;
 $esect   = $s + ((($cc-1) & 0x300) >> 2);
 $ecyl    = ($cc-1) & 0xff;
-$fstype  = 0x83;		# Linux (any better ideas?)
-$pentry  = 1;			# First partition slot
+$fstype  = hex($opt_t || "0x83");	# Linux (any better ideas?)
+$pentry  = $opt_p || 1;			# First partition slot
 
 for ( $i = 1 ; $i <= 4 ; $i++ ) {
     if ( $i == $pentry ) {
-- 
lfr
0/0




More information about the Syslinux mailing list