summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcarlosg <carlosg>2003-03-08 01:02:01 +0000
committercarlosg <carlosg>2003-03-08 01:02:01 +0000
commitfb0058864c2d619ab6321653e71782b27d4f366d (patch)
treeac4b38e0ef965e4c6e48fe1faca8ac025bf06842
parent0c02fadad05bfdde340acb90b3eef9f87708d721 (diff)
2003-03-08 Carlos Garnacho Parro <garnacho@tuxerver.net>
* boot-conf.in, boot.pl.in, partition.pl.in: modified to include partition list info in the xml (it sends the device and partition type for each partition)
-rw-r--r--ChangeLog6
-rw-r--r--boot-conf.in6
-rw-r--r--boot.pl.in8
-rw-r--r--partition.pl.in28
4 files changed, 31 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index a2cd4a5..d241bf3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2003-03-08 Carlos Garnacho Parro <garnacho@tuxerver.net>
+
+ * boot-conf.in, boot.pl.in, partition.pl.in: modified to include
+ partition list info in the xml (it sends the device and partition
+ type for each partition)
+
2003-03-04 Carlos Garnacho Parro <garnacho@tuxerver.net>
* boot-lilo.pl.in: lilo needs the vga settings in the "vga" entry, not
diff --git a/boot-conf.in b/boot-conf.in
index fde017a..f9ff7a1 100644
--- a/boot-conf.in
+++ b/boot-conf.in
@@ -125,7 +125,7 @@ sub xml_parse_boot
elsif ($elem eq "pixmap") { $$hash{"pixmap"} = &xst_xml_get_pcdata (shift @$tree); }
elsif ($elem eq "pixmapsup") { $$hash{"pixmapsup"} = &xst_xml_get_pcdata (shift @$tree); }
elsif ($elem eq "entry") { &xml_parse_entry (shift @$tree, \@entries); }
- elsif ($elem eq "partition") { shift @$tree; } # Just skip it.
+ elsif ($elem eq "partitions") { shift @$tree; } # Just skip it.
else { &xst_report ("xml_unexp_tag", $elem); shift @$tree; }
}
@@ -158,8 +158,8 @@ sub xml_print
&xst_xml_print_begin ();
-# &xst_xml_print_hash_hash ($$h{"partition"}, "partition");
-# &xst_xml_print_vspace ();
+ &xst_xml_print_hash ($$h{"partitions"}, "partitions");
+ &xst_xml_print_vspace ();
&xst_xml_print_scalars ($h, @scalars);
&xst_xml_print_structure ($$h{"entry"}, "entry");
diff --git a/boot.pl.in b/boot.pl.in
index 3bb08b4..35627f9 100644
--- a/boot.pl.in
+++ b/boot.pl.in
@@ -226,14 +226,14 @@ sub xst_boot_conf_get
},
table =>
[
- [ "partition", \&xst_partition_scan_info ],
+ [ "partitions", \&xst_partition_scan_info ],
# [ "pixmapsup", \&xst_parse_trivial, 0 ],
[ "timeout", \&xst_boot_lilo_parse_global, LILO_CONF, "delay" ],
[ "prompt", \&xst_boot_lilo_parse_global_kw, LILO_CONF, "prompt" ],
[ "default", \&xst_boot_lilo_parse_global, LILO_CONF, "default" ],
[ "boot", \&xst_boot_lilo_parse_global, LILO_CONF, "boot" ],
# [ "root", \&xst_boot_lilo_parse_global, LILO_CONF, "root" ],
- [ "entry", \&xst_boot_lilo_parse_entries, LILO_CONF, "%partition%" ],
+ [ "entry", \&xst_boot_lilo_parse_entries, LILO_CONF, "%partitions%" ],
]
},
@@ -247,13 +247,13 @@ sub xst_boot_conf_get
},
table =>
[
- [ "partition", \&xst_partition_scan_info ],
+ [ "partitions", \&xst_partition_scan_info ],
# [ "pixmapsup", \&xst_parse_trivial, 1 ],
# [ "pixmap", \&xst_boot_grub_parse_pixmap, [GRUB_CONF, DEVICE_MAP, MTAB] ],
[ "timeout", \&xst_boot_grub_parse_timeout, GRUB_CONF ],
[ "prompt", \&xst_boot_grub_parse_prompt, GRUB_CONF ],
[ "default", \&xst_boot_grub_parse_default, GRUB_CONF ],
- [ "entry", \&xst_boot_entries_get, "%partition%" ],
+ [ "entry", \&xst_boot_entries_get, "%partitions%" ],
]
}
);
diff --git a/partition.pl.in b/partition.pl.in
index 1192689..7d51854 100644
--- a/partition.pl.in
+++ b/partition.pl.in
@@ -35,7 +35,8 @@ require "$SCRIPTSDIR/report.pl$DOTIN";
sub xst_partition_scan_info
{
my ($fd, $line);
- my (%table);
+ my (%hash);
+ my (@table);
$fd = &xst_file_run_pipe ("sfdisk -d");
if ($fd eq undef)
@@ -47,21 +48,28 @@ sub xst_partition_scan_info
while ($line = <$fd>)
{
# Woohoo! sfdisk -d scanner in one line! Gotta love perl! OK, I'm a pig.
- if ($line =~ /^\/dev\/([^ \t]+)[ \t]*: start=[ \t]*([0-9]+), size=[ \t]*([0-9]+), Id=[ \t]*([0-9a-fA-F][0-9a-fA-F]?)(, bootable)?/)
+ if ($line =~ /^(\/dev\/[^ \t]+)[ \t]*: start=[ \t]*([0-9]+), size=[ \t]*([0-9]+), Id=[ \t]*([0-9a-fA-F][0-9a-fA-F]?)(, bootable)?/)
{
- $bootable = ($5 eq undef)? 0: 1;
- $table{$1} = {"dev" => $1,
- "start" => $2,
- "size" => $3,
- "id" => $4,
- "boot" => $bootable,
- "typestr" => $XST_FILESYS_TYPES{$4}
+ # we don't need empty partitions, so we reject those with id = 0
+ if ($4 ne 0)
+ {
+ $bootable = ($5 eq undef)? 0: 1;
+
+ push @table, {"dev" => $1,
+# "start" => $2,
+# "size" => $3,
+# "id" => $4,
+# "boot" => $bootable,
+ "type" => $XST_FILESYS_TYPES{$4}
};
+ }
}
}
close $fd;
- return \%table;
+ $hash{"partition"} = \@table;
+
+ return \%hash;
}
%XST_FILESYS_TYPES =