/* XPM */
static char * step_red_xpm[] = {
"21 21 195 2",
" c None",
". c #DFDFEF",
"+ c #DBDBED",
"@ c #D8D8EB",
"# c #D3D3E9",
"$ c #CDCDE6",
"% c #C8C8E3",
"& c #E1E1F0",
"* c #D7D7EB",
"= c #CECEE6",
"- c #C5C5E2",
"; c #C0C0DF",
"> c #BFBFDF",
", c #BBBBDD",
"' c #B3B3D9",
") c #C6C6E2",
"! c #B2B2D9",
"~ c #A5A5D2",
"{ c #9F9FCF",
"] c #B49CC1",
"^ c #D4899F",
"/ c #B893B7",
"( c #ACACD6",
"_ c #A4A4D1",
": c #DADAED",
"< c #D2D2E8",
"[ c #BABADC",
"} c #A4A4D2",
"| c #9B9BCD",
"1 c #9999CC",
"2 c #9D99CA",
"3 c #D69BB0",
"4 c #F66367",
"5 c #AA7DA3",
"6 c #9D9DCE",
"7 c #A2A2D0",
"8 c #9090C0",
"9 c #D4D4E9",
"0 c #D1D1E8",
"a c #BFB4D4",
"b c #A5A0CC",
"c c #9C99CB",
"d c #9A99CC",
"e c #B89DC1",
"f c #F99699",
"g c #F93F42",
"h c #A47497",
"i c #9E9ECE",
"j c #8F8FBF",
"k c #7979A2",
"l c #D797AB",
"m c #D49CB2",
"n c #C698B4",
"o c #BB9ABD",
"p c #BB9FC1",
"q c #E7A2AE",
"r c #FF8181",
"s c #F53536",
"t c #B16682",
"u c #9393C4",
"v c #73739A",
"w c #C3C3E1",
"x c #ADADD6",
"y c #CD7790",
"z c #FF6B6B",
"A c #FF8282",
"B c #F88E91",
"C c #F79398",
"D c #FF8383",
"E c #FF5E5E",
"F c #FF3636",
"G c #E14D5A",
"H c #B486AB",
"I c #A395C4",
"J c #9B98CA",
"K c #9595C6",
"L c #727298",
"M c #585875",
"N c #BCBCDE",
"O c #9C94C5",
"P c #C25E75",
"Q c #FD3333",
"R c #FF4E4E",
"S c #FF5757",
"T c #FF4040",
"U c #FF3D3D",
"V c #FE4747",
"W c #EF656D",
"X c #DB7E8F",
"Y c #CF7D95",
"Z c #C3708C",
"` c #75759C",
" . c #4E4E68",
".. c #B5B5DA",
"+. c #9E9ECF",
"@. c #9F91C0",
"#. c #D65466",
"$. c #FF3838",
"%. c #FF3535",
"&. c #FF3434",
"*. c #FC3232",
"=. c #F33131",
"-. c #E62E2E",
";. c #D82B2B",
">. c #BF2829",
",. c #A74554",
"'. c #74749A",
"). c #44445B",
"!. c #A9A9D4",
"~. c #BE83A4",
"{. c #FF5858",
"]. c #FF3F3F",
"^. c #FF3333",
"/. c #B42424",
"(. c #7B1D1F",
"_. c #743A48",
":. c #856482",
"<. c #8F7FA8",
"[. c #68688B",
"}. c #3E3E52",
"|. c #A3A3D1",
"1. c #9A9ACD",
"2. c #9D98C9",
"3. c #DB899B",
"4. c #FF6161",
"5. c #F53131",
"6. c #EB2F2F",
"7. c #F03030",
"8. c #D12A2A",
"9. c #8D262A",
"0. c #815B77",
"a. c #9389B6",
"b. c #9998CB",
"c. c #8C8CBA",
"d. c #9C9CCD",
"e. c #9999CB",
"f. c #B094BC",
"g. c #FB6769",
"h. c #D62B2B",
"i. c #9A1F1F",
"j. c #A82121",
"k. c #CA2828",
"l. c #C52727",
"m. c #92353F",
"n. c #9481AB",
"o. c #9696C8",
"p. c #7D7DA7",
"q. c #434359",
"r. c #8D8DBC",
"s. c #9191C2",
"t. c #A290BC",
"u. c #EA5661",
"v. c #BB2525",
"w. c #773D4C",
"x. c #835F7B",
"y. c #8A5F7C",
"z. c #A3363F",
"A. c #BC2525",
"B. c #9E3741",
"C. c #9A80A9",
"D. c #9898CA",
"E. c #5D5D7B",
"F. c #8080AB",
"G. c #A07AA0",
"H. c #AA5970",
"I. c #907396",
"J. c #9690C0",
"K. c #9896C8",
"L. c #9997C9",
"M. c #9D7EA5",
"N. c #A93239",
"O. c #95262A",
"P. c #98779B",
"Q. c #8E8EBE",
"R. c #6C6C90",
"S. c #777297",
"T. c #8986B2",
"U. c #9494C5",
"V. c #9D7396",
"W. c #84333D",
"X. c #8A6380",
"Y. c #6C6A8E",
"Z. c #565673",
"`. c #60607F",
" + c #8585B1",
".+ c #8989B6",
"++ c #78789F",
"@+ c #565672",
"#+ c #404055",
"$+ c #3F3F53",
"%+ c #47475F",
"&+ c #53536E",
"*+ c #585876",
"=+ c #52526D",
"-+ c #424258",
" ",
" . + @ # $ % ",
" & . * = - ; > ; , ' ",
" . @ ) ! ~ { ] ^ / ( ( _ ",
" : < [ } | 1 2 3 4 5 6 7 { 8 ",
" 9 0 a b c 1 d e f g h 1 | i j k ",
" $ > l m n o p q r s t 1 1 | u v ",
" w w x y z A B C D E F G H I J K L M ",
" N , _ O P Q R S R T U V W X Y Z ` . ",
" ..' +.1 @.#.$.$.%.&.*.=.-.;.>.,.'.). ",
" ( !.| 1 1 ~.{.].^.*.-./.(._.:.<.[.}. ",
" _ |.1.1 2.3.4.5.6.7.8.9.0.a.b.c.M }. ",
" | d.1 e.f.g.h.i.j.k.l.m.n.1 o.p.q.}. ",
" r.s.t.u.v.w.x.y.z.A.B.C.D.c.E.}. ",
" p.F.G.H.I.J.K.L.M.N.O.P.Q.R.}.}. ",
" R.S.T.U.e.1 1 e.V.W.X.Y.}.}. ",
" Z.`.'. +j u 8 .+++@+}.}. ",
" #+$+%+&+*+=+-+}.}.}. ",
" }.}.}.}.}.}. ",
" ",
" "};
a6'>user/martinw/mga6
Mageia Installer and base platform for many utilities
package partition_table;# $Id$use diagnostics;use strict;use common;use fs::type;use partition_table::raw;use detect_devices;uselog;sub hd2minimal_part {my($hd) =@_;{
rootDevice =>$hd->{device},
if_($hd->{usb_media_type}, is_removable =>1),};}#- works for both hard drives and partitions ;psub description {my($hd) =@_;my$win=$hd->{device_windobe};sprintf"%s%s(%s)",$hd->{device},$win&&" [$win:]",join(', ',grep{$_}
formatXiB($hd->{totalsectors} ||$hd->{size},512),$hd->{info},$hd->{mntpoint},$hd->{fs_type});}sub adjustStartAndEnd {my($hd, $part) =@_;$hd->adjustStart($part);$hd->adjustEnd($part);}sub verifyNotOverlap {my($a, $b) =@_;$a->{start} +$a->{size} <=$b->{start} ||$b->{start} +$b->{size} <=$a->{start};}sub verifyInside {my($a, $b) =@_;$b->{start} <=$a->{start} &&$a->{start} +$a->{size} <=$b->{start} +$b->{size};}sub verifyParts_ {foreachmy$i(@_) {foreach(@_) {next if!$i|| !$_||$i==$_|| isWholedisk($i) || isExtended($i);#- avoid testing twice for simplicity :-)if(isWholedisk($_)) {
verifyInside($i, $_)or
cdie sprintf("partition sector #$i->{start} (%s) is not inside whole disk (%s)!",
formatXiB($i->{size},512), formatXiB($_->{size},512));}elsif(isExtended($_)) {
verifyNotOverlap($i, $_)orlog::l(sprintf("warning partition sector #$i->{start} (%s) is overlapping with extended partition!",
formatXiB($i->{size},512)));#- only warning for this one is acceptable}else{
verifyNotOverlap($i, $_)or
cdie sprintf("partitions sector #$i->{start} (%s) and sector #$_->{start} (%s) are overlapping!",
formatXiB($i->{size},512), formatXiB($_->{size},512));}}}}sub verifyParts {my($hd) =@_;
verifyParts_(get_normal_parts($hd));}sub verifyPrimary {my($pt) =@_;$_->{start} >0|| arch() =~/^sparc/||die"partition must NOT start at sector 0"foreach@{$pt->{normal}};
verifyParts_(@{$pt->{normal}},$pt->{extended});}sub compute_device_name {my($part, $hd) =@_;$part->{device} =$hd->{prefix} .$part->{part_number};}sub assign_device_numbers {my($hd) =@_;my$i=1;my$start=1;#- on PPC we need to assign device numbers to the holes too - big FUN!#- not if it's an IBM machine using a DOS partition table thoughif(arch() =~/ppc/&& detect_devices::get_mac_model() !~/^IBM/) {#- first sort the normal parts$hd->{primary}{normal} = [sort{$a->{start} <=>$b->{start} } @{$hd->{primary}{normal}} ];#- now loop through them, assigning partition numbers - reserve one for the holesforeach(@{$hd->{primary}{normal}}) {if($_->{start} >$start) {log::l("PPC: found a hole on$hd->{prefix} before$_->{start}, skipping device...");$i++;}$_->{part_number} =$i;
compute_device_name($_, $hd);$start=$_->{start} +$_->{size};$i++;}}else{foreach(@{$hd->{primary}{raw}}) {$_->{part_number} =$i;
compute_device_name($_, $hd);$i++;}foreach(map{$_->{normal} } @{$hd->{extended} || []}) {my$dev=$hd->{prefix} .$i;my$renumbered=$_->{device} &&$devne$_->{device};if($renumbered) {require fs::mount;eval{ fs::mount::umount_part($_) };#- at least try to umount it
will_tell_kernel($hd, del =>$_,'delay_del');push@{$hd->{partitionsRenumbered}}, [$_->{device},$dev];}$_->{part_number} =$i;
compute_device_name($_, $hd);if($renumbered) {
will_tell_kernel($hd, add =>$_,'delay_add');}$i++;}}#- try to figure what the windobe drive letter could be!##- first verify there's at least one primary dos partition, otherwise it#- means it is a secondary disk and all will be false :(#-my($c, @others) =grep{ isFat_or_NTFS($_) } @{$hd->{primary}{normal}};$i=ord'C';$c->{device_windobe} =chr($i++)if$c;$_->{device_windobe} =chr($i++)foreachgrep{ isFat_or_NTFS($_) }map{$_->{normal} } @{$hd->{extended}};$_->{device_windobe} =chr($i++)foreach@others;}sub remove_empty_extended {my($hd) =@_;my$last=$hd->{primary}{extended}orreturn;@{$hd->{extended}} =grep{if($_->{normal}) {$last=$_;}else{%{$last->{extended}} =$_->{extended} ? %{$_->{extended}} : ();}$_->{normal};} @{$hd->{extended}};
adjust_main_extended($hd);}sub adjust_main_extended {my($hd) =@_;if(!is_empty_array_ref $hd->{extended}) {my($l, @l) = @{$hd->{extended}};# the first is a special case, must recompute its real sizemy$start= round_down($l->{normal}{start} -1,$hd->{geom}{sectors});my$end=$l->{normal}{start} +$l->{normal}{size};my$only_linux=1;my$has_win_lba=0;foreach(map{$_->{normal} }$l, @l) {$start= min($start, $_->{start});$end= max($end, $_->{start} +$_->{size});$only_linux&&= isTrueLocalFS($_) || isSwap($_);$has_win_lba||=$_->{pt_type} ==0xc||$_->{pt_type} ==0xe;}$l->{start} =$hd->{primary}{extended}{start} =$start;$l->{size} =$hd->{primary}{extended}{size} =$end-$start;}if(!@{$hd->{extended} || []} &&$hd->{primary}{extended}) {
will_tell_kernel($hd, del =>$hd->{primary}{extended});%{$hd->{primary}{extended}} = ();#- modify the raw entrydelete$hd->{primary}{extended};}
verifyParts($hd);#- verify everything is all right}sub adjust_local_extended {my($hd, $part) =@_;my$extended= find {$_->{normal} ==$part} @{$hd->{extended} || []}orreturn;$extended->{size} =$part->{size} +$part->{start} -$extended->{start};#- must write it there too because values are not sharedmy$prev= find {$_->{extended}{start} ==$extended->{start} } @{$hd->{extended} || []}orreturn;$prev->{extended}{size} =$part->{size} +$part->{start} -$prev->{extended}{start};}sub get_normal_parts {my($hd) =@_;@{$hd->{primary}{normal} || []},map{$_->{normal} } @{$hd->{extended} || []};}sub get_normal_parts_and_holes {my($hd) =@_;my($start, $last) = ($hd->first_usable_sector,$hd->last_usable_sector);ref($hd)or print("get_normal_parts_and_holes: bad hd". backtrace(),"\n");my$minimal_hole= put_in_hash({ pt_type =>0}, hd2minimal_part($hd));my@l=map{my$current=$start;$start=$_->{start} +$_->{size};my$hole= { start =>$current, size =>$_->{start} -$current, %$minimal_hole};
put_in_hash($hole, hd2minimal_part($hd));$hole, $_;}sort{$a->{start} <=>$b->{start} }grep{ !isWholedisk($_) } get_normal_parts($hd);push@l,{ start =>$start, size => min($last-$start, $hd->max_partition_size),%$minimal_hole}if$start<$hd->max_partition_start;grep{ !isEmpty($_) ||$_->{size} >=$hd->cylinder_size}@l;}sub _default_type {my($hd) =@_;
arch() =~/ia64/ ? 'gpt':
arch()eq"alpha" ? "bsd":
arch() =~/^sparc/ ? "sun":
arch()eq"ppc"&& detect_devices::get_mac_model() !~/^IBM/ ? "mac":$hd->{totalsectors} >4*1024*1024*2048 ? 'lvm':"dos";#- default to LVM on full disk when >4TB}sub initialize {my($hd, $o_type) =@_;my$type=$o_type|| _default_type($hd);require"partition_table/$type.pm";"partition_table::$type"->initialize($hd);delete$hd->{extended};if(detect_devices::is_xbox()) {my$part= { start =>1, size =>15632048, pt_type =>0x0bf, isFormatted =>1};
partition_table::dos::compute_CHS($hd, $part);$hd->{primary}{raw}[0] =$part;}}sub read_primary {my($hd) =@_;#- it can be safely considered that the first sector is used to probe the partition table#- but other sectors (typically for extended partition ones) have to match this type!my@parttype= (
if_(arch() =~/^ia64/,'gpt'),
arch() =~/^sparc/ ? ('sun','bsd') : ('dos','lvm','bsd','sun','mac'),);foreach('empty',@parttype,'unknown') {/unknown/and die"unknown partition table format on disk ".$hd->{file};# perl_checker: require partition_table::bsd# perl_checker: require partition_table::dos# perl_checker: require partition_table::empty# perl_checker: require partition_table::lvm# perl_checker: require partition_table::gpt# perl_checker: require partition_table::mac# perl_checker: require partition_table::sunrequire"partition_table/$_.pm";bless$hd,"partition_table::$_";if($hd->read_primary) {log::l("found a$_partition table on$hd->{file} at sector 0");return1;}}0;}subread{my($hd) =@_;
read_primary($hd)orreturn0;eval{my$need_removing_empty_extended;if($hd->{primary}{extended}) {
read_extended($hd, $hd->{primary}{extended}, \$need_removing_empty_extended)orreturn0;}if($need_removing_empty_extended) {#- special case when hda5 is empty, it must be skipped#- (windows XP generates such partition tables)
remove_empty_extended($hd);#- includes adjust_main_extended}};die"extended partition:$@"if$@;
assign_device_numbers($hd);
remove_empty_extended($hd);$hd->set_best_geometry_for_the_partition_table;1;}sub read_extended {my($hd, $extended, $need_removing_empty_extended) =@_;my$pt=do{my($pt, $info) =$hd->read_one($extended->{start})orreturn0;
partition_table::raw::pt_info_to_primary($hd, $pt, $info);};$pt= {%$extended, %$pt};push@{$hd->{extended}},$pt;@{$hd->{extended}} >100and die"oops, seems like we're looping here :( (or you have more than 100 extended partitions!)";if(@{$pt->{normal}} ==0) {$$need_removing_empty_extended=1;delete$pt->{normal};print"need_removing_empty_extended\n";}elsif(@{$pt->{normal}} >1) {die"more than one normal partition in extended partition";