summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2007-09-07 09:20:50 +0000
committerPascal Rigaux <pixel@mandriva.com>2007-09-07 09:20:50 +0000
commitedf4ce3c74ffb048d937cc505dbbfd5719d50f36 (patch)
tree4dfed2501c3919c66dc2494cbde51a99879185f5
parent23b75ec646306127dd7a9695507010c872c63a57 (diff)
downloadurpmi-edf4ce3c74ffb048d937cc505dbbfd5719d50f36.tar
urpmi-edf4ce3c74ffb048d937cc505dbbfd5719d50f36.tar.gz
urpmi-edf4ce3c74ffb048d937cc505dbbfd5719d50f36.tar.bz2
urpmi-edf4ce3c74ffb048d937cc505dbbfd5719d50f36.tar.xz
urpmi-edf4ce3c74ffb048d937cc505dbbfd5719d50f36.zip
4.10.7
-rw-r--r--MANIFEST86
-rw-r--r--NEWS2
-rw-r--r--urpm.pm2
3 files changed, 89 insertions, 1 deletions
diff --git a/MANIFEST b/MANIFEST
index 81938474..fb39dd96 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -169,6 +169,38 @@ t/data/SPECS/arch_to_noarch_1.spec
t/data/SPECS/arch_to_noarch_2.spec
t/data/SPECS/arch_to_noarch_3.spec
t/data/SPECS/arch_to_noarch_4.spec
+t/data/SPECS/file-conflicts/a.spec
+t/data/SPECS/file-conflicts/b.spec
+t/data/SPECS/file-conflicts/c.spec
+t/data/SPECS/file-conflicts/d.spec
+t/data/SPECS/file-conflicts/e.spec
+t/data/SPECS/file-conflicts/ga.spec
+t/data/SPECS/file-conflicts/gc.spec
+t/data/SPECS/file-conflicts/gc_.spec
+t/data/SPECS/file-conflicts/gd.spec
+t/data/SPECS/handle-conflict-deps/a-sup.spec
+t/data/SPECS/handle-conflict-deps/a.spec
+t/data/SPECS/handle-conflict-deps/b-sub.spec
+t/data/SPECS/handle-conflict-deps/b.spec
+t/data/SPECS/obsolete-and-conflict/a.spec
+t/data/SPECS/obsolete-and-conflict/b.spec
+t/data/SPECS/obsolete-and-conflict/c.spec
+t/data/SPECS/obsolete-and-conflict/d.spec
+t/data/SPECS/ordering-scriptlets/ash_1.spec
+t/data/SPECS/ordering-scriptlets/ash_2.spec
+t/data/SPECS/ordering-scriptlets/requires_post_1.spec
+t/data/SPECS/ordering-scriptlets/requires_post_2.spec
+t/data/SPECS/ordering-scriptlets/requires_postun_1.spec
+t/data/SPECS/ordering-scriptlets/requires_postun_2.spec
+t/data/SPECS/ordering-scriptlets/requires_pre_1.spec
+t/data/SPECS/ordering-scriptlets/requires_pre_2.spec
+t/data/SPECS/ordering-scriptlets/requires_preun_1.spec
+t/data/SPECS/ordering-scriptlets/requires_preun_2.spec
+t/data/SPECS/prefer/a.spec
+t/data/SPECS/prefer/b.spec
+t/data/SPECS/prefer/b_foo.spec
+t/data/SPECS/prefer/c.spec
+t/data/SPECS/prefer/c_foo.spec
t/data/SPECS/priority-upgrade-1/a-strict_1.spec
t/data/SPECS/priority-upgrade-1/a_1.spec
t/data/SPECS/priority-upgrade-1/b_1.spec
@@ -177,7 +209,49 @@ t/data/SPECS/priority-upgrade-2/a_2.spec
t/data/SPECS/priority-upgrade-2/b_2.spec
t/data/SPECS/priority-upgrade-2/bb1_2.spec
t/data/SPECS/priority-upgrade-2/bb2_2.spec
+t/data/SPECS/provide-and-no-obsolete/a-1.spec
+t/data/SPECS/provide-and-no-obsolete/a-2.spec
+t/data/SPECS/provide-and-no-obsolete/b-3.spec
+t/data/SPECS/README-urpmi/a.spec
+t/data/SPECS/README-urpmi/b.spec
+t/data/SPECS/README-urpmi/b_2.spec
+t/data/SPECS/README-urpmi/b_3.spec
+t/data/SPECS/README-urpmi/c.spec
+t/data/SPECS/README-urpmi/d.spec
+t/data/SPECS/README-urpmi/d_.spec
+t/data/SPECS/rpmnew/a-1.spec
+t/data/SPECS/rpmnew/a-2.spec
+t/data/SPECS/rpmnew/a-3.spec
+t/data/SPECS/split-transactions--conflict-1/a.spec
+t/data/SPECS/split-transactions--conflict-1/b.spec
+t/data/SPECS/split-transactions--conflict-1/c.spec
+t/data/SPECS/split-transactions--conflict-2/b.spec
+t/data/SPECS/split-transactions--conflict-2/d.spec
+t/data/SPECS/split-transactions--strict-require-1/a.spec
+t/data/SPECS/split-transactions--strict-require-1/b.spec
+t/data/SPECS/split-transactions--strict-require-2/a.spec
+t/data/SPECS/split-transactions--strict-require-2/b.spec
+t/data/SPECS/split-transactions--strict-require-and-obsolete-1/a.spec
+t/data/SPECS/split-transactions--strict-require-and-obsolete-1/bb.spec
+t/data/SPECS/split-transactions--strict-require-and-obsolete-1/c-1.spec
+t/data/SPECS/split-transactions--strict-require-and-obsolete-2/a.spec
+t/data/SPECS/split-transactions--strict-require-and-obsolete-2/b.spec
+t/data/SPECS/split-transactions--strict-require-and-obsolete-2/c-2.spec
+t/data/SPECS/split-transactions/a.spec
+t/data/SPECS/split-transactions/b.spec
+t/data/SPECS/split-transactions/c.spec
+t/data/SPECS/split-transactions/d.spec
t/data/SPECS/srpm-bootstrapping.spec
+t/data/SPECS/suggests/a-1.spec
+t/data/SPECS/suggests/a-2.spec
+t/data/SPECS/suggests/a-3.spec
+t/data/SPECS/suggests/b.spec
+t/data/SPECS/suggests/bb.spec
+t/data/SPECS/suggests/c.spec
+t/data/SPECS/suggests/cc.spec
+t/data/SPECS/suggests/suggested_b.spec
+t/data/SPECS/suggests/suggested_c.spec
+t/data/SPECS/suggests/with-invalid.spec
t/data/SPECS/various.spec
t/data/SPECS/various2.spec
t/data/SPECS/various3.spec
@@ -189,11 +263,23 @@ t/superuser--addmedia.t
t/superuser--arch_to_noarch.t
t/superuser--buggy-rpms.t
t/superuser--exclude.t
+t/superuser--file-conflicts.t
+t/superuser--handle-conflict-deps.t
t/superuser--http.t
t/superuser--media_info_dir.t
+t/superuser--obsolete-and-conflict.t
+t/superuser--ordering-scriptlets.t
+t/superuser--prefer.t
t/superuser--priority-upgrade.t
+t/superuser--provide-and-no-obsolete.t
+t/superuser--README-urpmi.t
+t/superuser--rpmnew.t
t/superuser--specify-media.t
+t/superuser--split-transactions--conflict.t
+t/superuser--split-transactions--strict-require-and-obsolete.t
+t/superuser--split-transactions.t
t/superuser--srpm-bootstrapping.t
+t/superuser--suggests.t
urpm.pm
urpm/args.pm
urpm/bug_report.pm
diff --git a/NEWS b/NEWS
index 8255acfd..65c4d602 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,5 @@
+Version 4.10.7 - 6 September 2007, by Pascal "Pixel" Rigaux
+
- urpmi
o fix rpmdb locking with --root
o handle --searchmedia <media1>,...,<mediaN>
diff --git a/urpm.pm b/urpm.pm
index a75e333d..d89581a6 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -12,7 +12,7 @@ use urpm::sys;
use urpm::cfg;
use urpm::md5sum;
-our $VERSION = '4.10.6';
+our $VERSION = '4.10.7';
our @ISA = qw(URPM Exporter);
our @EXPORT_OK = 'file_from_local_url';
a> 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162
package diskdrake::interactive; # $Id$

use diagnostics;
use strict;

use common;
use partition_table qw(:types);
use partition_table_raw;
use detect_devices;
use run_program;
use loopback;
use devices;
use fsedit;
use raid;
use any;
use log;
use fs;


=begin

struct part {
  int active            # one of { 0 | 0x80 }  x86 only, primary only
  int start             # in sectors
  int size              # in sectors
  int type              # 0x82, 0x83, 0x6 ...
  string device         # 'hda5', 'sdc1' ...
  string rootDevice     # 'sda', 'hdc' ...
  string real_mntpoint  # directly on real /, '/tmp/hdimage' ...
  string mntpoint       # '/', '/usr' ...
  string options        # 'defaults', 'noauto'
  string device_windobe # 'C', 'D' ...
  string encrypt_key    # [0-9A-Za-z./]{20,}
  string comment        # comment to have in fstab

  bool isMounted

  bool isFormatted
  bool notFormatted 
    #  isFormatted                  means the device is formatted
    # !isFormatted &&  notFormatted means the device is not formatted
    # !isFormatted && !notFormatted means we don't know which state we're in

  int raid          # for partitions of type isRawRAID and which isPartOfRAID, the raid device number
  string lvm        # partition used as a PV for the VG with {lvm} as LVMname
  loopback loopback[]   # loopback living on this partition

  # internal
  string real_device     # '/dev/loop0', '/dev/loop1' ...

  # internal CHS (Cylinder/Head/Sector)
  int start_cyl, start_head, start_sec, end_cyl, end_head, end_sec, 
}

struct part_allocate inherits part {
  int maxsize        # in sectors (alike "size")
  int ratio          # 
  string hd          # 'hda', 'hdc'
  string parts       # for creating raid partitions. eg: 'foo bar' where 'foo' and 'bar' are mntpoint
}

struct part_raid inherits part {
  string chunk-size  # usually '64k'
  string level       # one of { 0, 1, 4, 5, 'linear' }

  part disks[]

  # invalid: active, start, rootDevice, device_windobe?, CHS
}

struct part_loopback inherits part {
  string loopback_file   # absolute file name which is relative to the partition
  part loopback_device   # where the loopback file live

  # device is special here: it is the absolute filename of the loopback file.

  # invalid: active, start, rootDevice, device_windobe, CHS
}

struct part_lvm inherits part {
  # invalid: active, start, device_windobe, CHS
}


struct partition_table_elem {
  part normal[]     #
  part extended     # the main/next extended
  part raw[4]       # primary partitions
}

struct geom {
  int heads 
  int sectors
  int cylinders
  int totalcylinders # for SUN, forget it
  int start          # always 0, forget it
}

struct hd {
  int totalsectors      # size in sectors
  string device         # 'hda', 'sdc' ...
  string device_alias   # 'cdrom', 'floppy' ...
  string media_type     # one of { 'hd', 'cdrom', 'fd', 'tape' }
  string capacity       # contain of the strings of { 'burner', 'DVD' }
  string info           # name of the hd, eg: 'QUANTUM ATLAS IV 9 WLS'

  bool isDirty          # does it need to be written to the disk 
  bool needKernelReread # must we tell the kernel to reread the partition table
  bool hasBeenDirty     # for undo
  bool rebootNeeded     # happens when a kernel reread failed
  bool partitionsRenumbered # happens when you
                            # - remove an extended partition which is not the last one
                            # - add an extended partition which is the first extended partition
  int bus, id
  
  partition_table_elem primary
  partition_table_elem extended[]

  geom geom

  # internal
  string prefix         # for some RAID arrays device=>c0d0 and prefix=>c0d0p
  string file           # '/dev/hda' ...
}

struct hd_lvm inherits hd {
  int PE_size           # block size (granularity, similar to cylinder size on x86)
  string LVMname        # VG name

  part_lvm disks[]

  # invalid: bus, id, extended, geom
}

struct raw_hd inherits hd {
  string type       # 0x82, 0x83, 'nfs', ...
  string mntpoint   # '/', '/usr' ...
  string options    # 'defaults', 'noauto'

  # invalid: isDirty, needKernelReread, hasBeenDirty, rebootNeeded, primary, extended
}

struct all_hds {
  hd hds[]
  hd_lvm lvms[]
  part_raid raids[]     # indexed by number: raids[$n]{device} is "md$n"
  part_loopback loopbacks[]
  raw_hd raw_hds[]
  raw_hd nfss[]
  raw_hd smbs[]
  raw_hd special[]

  # internal: if fstab_to_string($all_hds) eq current_fstab then no need to save
  string current_fstab
}


=cut


sub main {
    my ($in, $all_hds) = @_;

    if ($in->isa('interactive_gtk')) {
	require diskdrake::hd_gtk;
	goto &diskdrake::hd_gtk::main;
    }

    my ($current_part, $current_hd);
    
    while (1) {
	my $choose_txt = $current_part ? __("Choose another partition") : __("Choose a partition");
	my $parts_and_holes = [ fsedit::get_all_fstab_and_holes($all_hds) ];
	my $choose_part = sub {
	    $current_part = $in->ask_from_listf('diskdrake', translate($choose_txt), sub { format_part_info_short(fsedit::part2hd($_[0], $all_hds), $_[0]) }, $parts_and_holes, $current_part) || return;
	    $current_hd = fsedit::part2hd($current_part, $all_hds);
	};

	$choose_part->() if !$current_part;
	return if !$current_part;

	my %actions = my @actions = (
            if_($current_part, 
          (map { my $s = $_; $_ => sub { $diskdrake::interactive::{$s}($in, $current_hd, $current_part, $all_hds) } } part_possible_actions($in, $current_hd, $current_part, $all_hds)),
		'____________________________' => sub {},
            ),
            if_(@$parts_and_holes > 1, $choose_txt => $choose_part),
	    if_($current_hd,
	  (map { my $s = $_; $_ => sub { $diskdrake::interactive::{$s}($in, $current_hd, $all_hds) } } hd_possible_actions_interactive($in, $current_hd, $all_hds)),
	    ), 
	  (map { my $s = $_; $_ => sub { $diskdrake::interactive::{$s}($in, $all_hds) } } general_possible_actions($in, $all_hds)),
        );
	my ($actions) = list2kv(@actions);
	my $a;
	if ($current_part) {
	    $in->ask_from_({
			    cancel => _("Exit"), 
			    title => 'diskdrake',
			    messages => format_part_info($current_hd, $current_part),
			   },
			   [ { val => \$a, list => $actions, format => \&translate, type => 'list', sort => 0, gtk => { use_boxradio => 0 } } ]) or last;
	    $actions{$a}();
	    $current_hd = $current_part = '' if !is_part_existing($current_part, $all_hds);	    
	} else {
	    $choose_part->();
	}
	partition_table::assign_device_numbers($_) foreach fsedit::all_hds($all_hds);
    }
    Done($in, $all_hds) or goto &main;
}




################################################################################
# general actions
################################################################################
sub general_possible_actions {
    __("Undo"), ($::expert ? __("Toggle to normal mode") : __("Toggle to expert mode"));
}


sub Undo {
    my ($in, $all_hds) = @_;
    fsedit::undo($all_hds);
}

sub Wizard {
    $::o->{wizard} = 1;
    goto &Done;
}

sub Done {
    my ($in, $all_hds) = @_;
    eval { raid::verify($all_hds->{raids}) };
    if (my $err = $@) {
	$::expert or die;
	$in->ask_okcancel('', [ formatError($err), _("Continue anyway?")]) or return;
    }
    foreach (@{$all_hds->{hds}}) {
	if (!write_partitions($in, $_)) {
	    return if !$::isStandalone;
	    $in->ask_yesorno(_("Quit without saving"), _("Quit without writing the partition table?"), 1) or return;
	}
    }
    if (!$::isInstall) {
	my $new = fs::fstab_to_string($all_hds);
	if ($new ne $all_hds->{current_fstab} && $in->ask_yesorno('', _("Do you want to save /etc/fstab modifications"), 1)) {
	    $all_hds->{current_fstab} = $new;
	    fs::write_fstab($all_hds);
	}
    }
    1;
}

################################################################################
# per-hd actions
################################################################################
sub hd_possible_actions {
    __("Clear all"), if_($::isInstall, __("Auto allocate")), __("More");
}
sub hd_possible_actions_interactive {
    hd_possible_actions(), __("Hard drive information");
}

sub Clear_all {
    my ($in, $hd, $all_hds) = @_;
    isPartOfLVM($_) and RemoveFromLVM($in, $hd, $_, $all_hds) foreach partition_table::get_normal_parts($hd);
    partition_table_raw::zero_MBR_and_dirty($hd);
}

sub Auto_allocate {
    my ($in, $hd, $all_hds) = @_;
    my $suggestions = partitions_suggestions($in) or return;

    my %all_hds_ = %$all_hds;
    $all_hds_{hds} = [ sort { $a == $hd ? -1 : 1 } @{$all_hds->{hds}} ];

    eval { fsedit::auto_allocate(\%all_hds_, $suggestions) };
    if ($@) {
	$@ =~ /partition table already full/ or die;

	$in->ask_warn("", [ 
			   _("All primary partitions are used"),
			   _("I can't add any more partition"), 
			   _("To have more partitions, please delete one to be able to create an extended partition"),
			  ]);
    }
}

sub More {
    my ($in, $hd) = @_;

    $in->ask_from('', '',
	    [
	     { val => _("Save partition table"),    clicked_may_quit => sub { SaveInFile($in, $hd);   1 } },
	     { val => _("Restore partition table"), clicked_may_quit => sub { ReadFromFile($in, $hd); 1 } },
	     { val => _("Rescue partition table"),  clicked_may_quit => sub { Rescuept($in, $hd);     1 } },
	         if_($::isInstall, 
	     { val => _("Reload partition table"), clicked => sub { 
		   $::o->{all_hds} = fsedit::empty_all_hds();
		   die "setstep doPartitionDisks\n" if $::setstep;
	       } }),
	         if_($::isInstall, 
	     { text => _("Removable media automounting"), val => \$::o->{useSupermount}, type => 'bool' },
		 ),
	    ],
    );
}

sub ReadFromFile {
    my ($in, $hd) = @_;

    my $file = $::isStandalone ? $in->ask_file(_("Select file")) : devices::make("fd0") or return;

    eval {
    catch_cdie { partition_table::load($hd, $file) }
      sub {
	  $@ =~ /bad totalsectors/ or return;
	  $in->ask_yesorno('',
_("The backup partition table has not the same size
Still continue?"), 0);
      };
    };
    if (my $err = $@) {
    	$in->ask_warn(_("Error"), formatError($err));
    }
}

sub SaveInFile {
    my ($in, $hd) = @_;

    my $file = $::isStandalone ?
		 $in->ask_file(_("Select file")) :
                 $in->ask_okcancel(_("Warning"),
_("Insert a floppy in drive
All data on this floppy will be lost"), 1) && devices::make(detect_devices::floppy()) or return;

    eval { partition_table::save($hd, $file) };
    if (my $err = $@) {
    	$in->ask_warn(_("Error"), formatError($err));
    }
}

sub Rescuept {
    my ($in, $hd) = @_;
    my $w = $in->wait_message('', _("Trying to rescue partition table"));
    fsedit::rescuept($hd);
}

sub Hd_info {
    my ($in, $hd) = @_;
    $in->ask_warn('', [ _("Detailed information"), format_hd_info($hd) ]);
}

################################################################################
# per-part actions
################################################################################

sub part_possible_actions {
    my ($in, $hd, $part, $all_hds) = @_;
    $part or return;

    my %actions = my @l = (
        __("Mount point")      => '($part->{real_mntpoint} && common::usingRamdisk()) || (!isBusy && !isSwap && !isNonMountable)',
        __("Type")             => '!isBusy && $::expert',
        __("Options")          => '$::expert',
        __("Resize")	       => '!isBusy && !isSpecial || isLVM($hd) && isMounted && isThisFs("xfs", $part)',
        __("Move")             => '!isBusy && !isSpecial && $::expert && 0', # disable for the moment
        __("Format")           => '!isBusy && ($::expert || $::isStandalone)',
        __("Mount")            => '!isBusy && (hasMntpoint || isSwap) && maybeFormatted && ($::expert || $::isStandalone)',
        __("Add to RAID")      => '!isBusy && isRawRAID && !isSpecial',
        __("Add to LVM")       => '!isBusy && isRawLVM',
        __("Unmount")          => '!$part->{real_mntpoint} && isMounted',
        __("Delete")	       => '!isBusy',
        __("Remove from RAID") => 'isPartOfRAID',
        __("Remove from LVM")  => 'isPartOfLVM',
        __("Modify RAID")      => 'isPartOfRAID && !isMounted($all_hds->{raids}[$part->{raid}])',
        __("Use for loopback") => '!$part->{real_mntpoint} && isMountableRW && !isSpecial && hasMntpoint && $::expert',
    );
    my ($actions_names) = list2kv(@l);
    my %macros = (
        hasMntpoint => '$part->{mntpoint}',
        isPrimary => 'isPrimary($part, $hd)',
    );
    if ($part->{type} == 0) {
	__("Create");
    } else {
        grep { 
    	    my $cond = $actions{$_};
    	    while (my ($k, $v) = each %macros) {
    	        $cond =~ s/$k/qq(($v))/e;
    	    }
    	    $cond =~ s/(^|[^:\$]) \b ([a-z]\w{3,}) \b ($|[\s&\)])/$1 . $2 . '($part)' . $3/exg;
    	    eval $cond;
        } @$actions_names;
    }
}

sub Create {
    my ($in, $hd, $part, $all_hds) = @_;
    my ($def_start, $def_size, $max) = ($part->{start}, $part->{size}, $part->{start} + $part->{size});

    $part->{maxsize} = $part->{size}; $part->{size} = 0;
    if (!fsedit::suggest_part($part, $all_hds)) {
	$part->{size} = $part->{maxsize};
	$part->{type} ||= 0x483;
    }

    #- update adjustment for start and size, take into account the minimum partition size
    #- including one less sector for start due to a capacity to increase the adjustement by
    #- one.
    my ($primaryOrExtended, $migrate_files);
    my $type = type2name($part->{type});
    my $mb_size = $part->{size} >> 11;
    my $has_startsector = ($::expert || arch() !~ /i.86/) && !isLVM($hd);

    my $w = $in->ask_from(_("Create a new partition"), '',
        [
           if_($has_startsector,
         { label => _("Start sector: "), val => \$part->{start}, min => $def_start, max => ($max - min_partition_size($hd)), type => 'range' },
           ),
         { label => _("Size in MB: "), val => \$mb_size, min => min_partition_size($hd) >> 11, max => $def_size >> 11, type => 'range' },
         { label => _("Filesystem type: "), val => \$type, list => [ partition_table::important_types() ], sort => 0 },
         { label => _("Mount point: "), val => \$part->{mntpoint}, list => [ fsedit::suggestions_mntpoint($all_hds), '' ],
           disabled => sub { my $p = { type => name2type($type) }; isSwap($p) || isNonMountable($p) }, type => 'combo', not_edit => 0,
         },
           if_($::expert && $hd->hasExtended,
         { label => _("Preference: "), val => \$primaryOrExtended, list => [ '', "Extended", "Primary", if_($::expert, "Extended_0x85") ] },
           ),
        ], changed => sub {
	    if ($part->{start} + ($mb_size << 11) > $max) {
		if ($_[0] == 0) {
		    # Start sector changed => restricting Size
		    $mb_size = ($max - $part->{start}) >> 11; 
		} else {
		    # Size changed => restricting Start sector
		    $part->{start} = $max - ($mb_size << 11); 
		}
	    }
        }, complete => sub {
	    $part->{size} = from_Mb($mb_size, min_partition_size($hd), $max - $part->{start}); #- need this to be able to get back the approximation of using MB
	    $part->{type} = name2type($type);
	    $part->{mntpoint} = '' if isNonMountable($part);
	    $part->{mntpoint} = 'swap' if isSwap($part);
	    fs::set_default_options($part);

	    check($in, $hd, $part, $all_hds) or return 1;
	    $migrate_files = need_migration($in, $part->{mntpoint}) or return 1;

	    fsedit::add($hd, $part, $all_hds, { force => 1, primaryOrExtended => $primaryOrExtended });
	    0;
	},
    ) or return;

    warn_if_renumbered($in, $hd);

    if ($migrate_files eq 'migrate') {
	format_($in, $hd, $part, $all_hds) or return;
	migrate_files($in, $hd, $part);
	fs::mount_part($part);
    }
}

sub Delete {
    my ($in, $hd, $part, $all_hds) = @_;
    if (isRAID($part)) {
	raid::delete($all_hds->{raids}, $part);
    } elsif (isLVM($hd)) {
	lvm::lv_delete($hd, $part);
    } elsif (isLoopback($part)) {
	my $f = "$part->{loopback_device}{mntpoint}$part->{loopback_file}";
	if (-e $f && $in->ask_yesorno('', _("Remove the loopback file?"))) {
	    unlink $f;
	}
	my $l = $part->{loopback_device}{loopback};
	@$l = grep { $_ != $part } @$l;
	delete $part->{loopback_device}{loopback} if @$l == 0;
	fsedit::recompute_loopbacks($all_hds);
    } else {
	if (arch() =~ /ppc/) {
	    undef $partition_table_mac::bootstrap_part if (isAppleBootstrap($part) && ($part->{device} = $partition_table_mac::bootstrap_part));
	}
	partition_table::remove($hd, $part);
	warn_if_renumbered($in, $hd);
    }
}

sub Type {
    my ($in, $hd, $part) = @_;

    my $warn = sub { ask_alldatawillbelost($in, $part, __("After changing type of partition %s, all data on this partition will be lost")) };

    #- for ext2, warn after choosing as ext2->ext3 can be achieved without loosing any data :)
    isExt2($part) or $warn->() or return;

    my $type_name = type2name($part->{type});
    $in->ask_from(_("Change partition type"),
		  _("Which filesystem do you want?"),
		  [ { label => _("Type"), val => \$type_name, list => [ partition_table::important_types() ], sort => 0, not_edit => !$::expert } ]) or return;

    my $type = $type_name && name2type($type_name);

    if (isExt2($part) && isThisFs('ext3', { type => $type })) {
	my $w = $in->wait_message('', _("Switching from ext2 to ext3"));
	if (run_program::run("tune2fs", "-j", devices::make($part->{device}))) {
	    $part->{type} = $type;
	    $part->{isFormatted} = 1; #- assume that if tune2fs works, partition is formatted

	    #- disable the fsck (don't do it together with -j in case -j fails?)
	    fs::disable_forced_fsck($part->{device});	    
	    return;
	}
    }
    #- either we switch to non-ext3 or switching losslessly to ext3 failed
    !isExt2($part) or $warn->() or return;

    if (defined $type) {
	check_type($in, $type, $hd, $part) and fsedit::change_type($type, $hd, $part);
    }
}

sub Mount_point {
    my ($in, $hd, $part, $all_hds) = @_;

    my $migrate_files;
    my $mntpoint = $part->{mntpoint} || do {
	my $part_ = { %$part };
	if (fsedit::suggest_part($part_, $all_hds)) {
	    fsedit::has_mntpoint('/', $all_hds) || $part_->{mntpoint} eq '/boot' ? $part_->{mntpoint} : '/';
	} else { '' }
    };
    $in->ask_from(
        '',
        isLoopback($part) ? _("Where do you want to mount loopback file %s?", $part->{loopback_file}) :
			    _("Where do you want to mount device %s?", $part->{device}),
	[ { label => _("Mount point"), val => \$mntpoint, 
	    list => [ if_($mntpoint, $mntpoint), fsedit::suggestions_mntpoint($all_hds), '' ], 
	    not_edit => !$::expert } ],
	complete => sub {
	    !isPartOfLoopback($part) || $mntpoint or $in->ask_warn('', 
_("Can't unset mount point as this partition is used for loop back.
Remove the loopback first")), return 1;
	    $part->{mntpoint} eq $mntpoint || check_mntpoint($in, $mntpoint, $hd, $part, $all_hds) or return 1;
    	    $migrate_files = need_migration($in, $mntpoint) or return 1;
	    0;
	}
    ) or return;
    $part->{mntpoint} = $mntpoint;

    if ($migrate_files eq 'migrate') {
	format_($in, $hd, $part, $all_hds) or return;
	migrate_files($in, $hd, $part);
	fs::mount_part($part);
    }
}
sub Mount_point_raw_hd {
    my ($in, $part, $all_hds, $propositions) = @_;

    my $mntpoint = $part->{mntpoint};
    $in->ask_from(
        '',
        _("Where do you want to mount device %s?", $part->{device}),
	[ { label => _("Mount point"), val => \$mntpoint, 
	    list => [ if_($mntpoint, $mntpoint), '', @$propositions ], 
	    not_edit => 0 } ],
	complete => sub {
	    $part->{mntpoint} eq $mntpoint || check_mntpoint($in, $mntpoint, {}, $part, $all_hds) or return 1;
	    0;
	}
    ) or return;
    $part->{mntpoint} = $mntpoint;
}

sub Resize {
    my ($in, $hd, $part) = @_;
    my (%nice_resize, $block_count, $free_block, $block_size);
    my ($min, $max) = (min_partition_size($hd), partition_table::next_start($hd, $part) - $part->{start});

    if (maybeFormatted($part)) {
	# here we may have a non-formatted or a formatted partition
	# -> doing as if it was formatted

	if (isFat($part)) {
	    write_partitions($in, $hd) or return;
	    #- try to resize without losing data
	    my $w = $in->wait_message(_("Resizing"), _("Computing FAT filesystem bounds"));

	    $nice_resize{fat} = resize_fat::main->new($part->{device}, devices::make($part->{device}));
	    $min = max($min, $nice_resize{fat}->min_size);
	    $max = min($max, $nice_resize{fat}->max_size);	    
	} elsif (isExt2($part) || isThisFs('ext3', $part)) {
	    write_partitions($in, $hd) or return;
	    $nice_resize{ext2} = devices::make($part->{device});
	    my $r = `dumpe2fs $nice_resize{ext2} 2>/dev/null`;
	    $r =~ /Block count:\s*(\d+)/ and $block_count = $1;
	    $r =~ /Free blocks:\s*(\d+)/ and $free_block = $1;
	    $r =~ /Block size:\s*(\d+)/ and $block_size = $1;
	    log::l("dumpe2fs $nice_resize{ext2} gives: Block_count=$block_count, Free_blocks=$free_block, Block_size=$block_size");
	    if ($block_count && $free_block && $block_size) {
		$min = max($min, ($block_count - $free_block) * $block_size / 512);
		$max = min($max, $block_count * $block_size / 512);
	    } else {
		delete $nice_resize{ext2};
	    }
	} elsif (isThisFs("reiserfs", $part)) {
	    write_partitions($in, $hd) or return;
	    if (defined (my $free = fs::df($part))) {
		$nice_resize{reiserfs} = 1;		  
		$min = max($min, $free);
	    }
	} elsif (isThisFs('xfs', $part) && isLVM($hd) && $::isStandalone && isMounted($part)) {
	    $min = $part->{size}; #- ensure the user can only increase
	    $nice_resize{xfs} = 1;
	}
	#- make sure that even after normalizing the size to cylinder boundaries, the minimun will be saved,
	#- this save at least a cylinder (less than 8Mb).
	$min += partition_table_raw::cylinder_size($hd);
	$min >= $max and return $in->ask_warn('', _("This partition is not resizeable"));

	#- for these, we have tools to resize partition table
	#- without losing data (or at least we hope so :-)
	if (%nice_resize) {
	    ask_alldatamaybelost($in, $part, __("All data on this partition should be backed-up")) or return;
	} else {
	    ask_alldatawillbelost($in, $part, __("After resizing partition %s, all data on this partition will be lost")) or return;
	}
    }

    my $mb_size = $part->{size} >> 11;
    $in->ask_from(_("Resize"), _("Choose the new size"), [ 
		   { label => _("New size in MB: "), val => \$mb_size, min => $min >> 11, max => $max >> 11, type => 'range' },
		]) or return;


    my $size = from_Mb($mb_size, $min, $max);
    $part->{size} == $size and return;

    my $oldsize = $part->{size};
    $hd->{isDirty} = $hd->{needKernelReread} = 1;
    $part->{size} = $size;
    $hd->adjustEnd($part);

    undef $@;
    my $b = before_leaving { $@ and $part->{size} = $oldsize };
    my $w = $in->wait_message(_("Resizing"), '');

    if (isLVM($hd)) {
	lvm::lv_resize($part, $oldsize) if $size > $oldsize;	
    }

    if ($nice_resize{fat}) {
	local *log::l = sub { $w->set(join(' ', @_)) };
	$nice_resize{fat}->resize($part->{size});
    } elsif ($nice_resize{ext2}) {
	my $s = int(($part->{size} << 9) / $block_size);
	log::l("resize2fs $nice_resize{ext2} to size $s in block of $block_size bytes");
	system "resize2fs", "-pf", $nice_resize{ext2}, $s;
    } elsif ($nice_resize{reiserfs}) {
	log::l("reiser resize to $part->{size} sectors");
	install_any::check_prog ("resize_reiserfs") if $::isInstall;
	system "resize_reiserfs", "-f", "-q", "-s" . $part->{size}/2 . "K", devices::make($part->{device});
    } elsif ($nice_resize{xfs}) {
	system "xfs_growfs", $part->{mntpoint};
    }

    if (%nice_resize) {
	$part->{isFormatted} = 1;
    } else {
	$part->{notFormatted} = 1;
	$part->{isFormatted} = 0;
	partition_table::verifyParts($hd);
    }

    if (isLVM($hd)) {
	lvm::lv_resize($part, $oldsize) if $size < $oldsize;
    } else {
	partition_table::adjust_local_extended($hd, $part);
	partition_table::adjust_main_extended($hd);
    }
}
sub Move {
    my ($in, $hd, $part, $all_hds) = @_;
    my $hd2 = $in->ask_from_listf(_("Move"),
				  _("Which disk do you want to move it to?"), \&partition_table::description, @{$all_hds->{hds}}) or return;
    my $start2 = $in->ask_from_entry(_("Sector"),
				     _("Which sector do you want to move it to?"));
    defined $start2 or return;

    my $w = $in->wait_message(_("Moving"), _("Moving partition..."));
    fsedit::move($hd, $part, $hd2, $start2);
}
sub Format {
    my ($in, $hd, $part, $all_hds) = @_;
    format_($in, $hd, $part, $all_hds);
}
sub Mount {
    my ($in, $hd, $part) = @_;
    write_partitions($in, $hd) or return;
    fs::mount_part($part);
}
sub Add2RAID {
    my ($in, $hd, $part, $all_hds) = @_;
    my $raids = $all_hds->{raids};

    local $_ = @$raids == () ? "new" :
      $in->ask_from_list_('', _("Choose an existing RAID to add to"),
			  [ (grep {$_} map_index { $_ && "md$::i" } @$raids), __("new") ]) or return;

    if (/new/) {
	my $nb1 = raid::new($raids, $part);
	defined modifyRAID($in, $raids, $nb1) or return raid::delete($raids, $nb1);
    } else {
	raid::add($raids, $part, $_);
    }
    raid::update(@$raids);
}
sub Add2LVM {
    my ($in, $hd, $part, $all_hds) = @_;
    my $lvms = $all_hds->{lvms};
    write_partitions($in, $_) or return foreach isRAID($part) ? @{$all_hds->{hds}} : $hd;

    my $lvm = $in->ask_from_listf_('', _("Choose an existing LVM to add to"),
				  sub { ref $_[0] ? $_[0]{LVMname} : $_[0] },
				  [ @$lvms, __("new") ]) or return;
    if (!ref $lvm) {
	# create new lvm
	my $name = $in->ask_from_entry('', _("LVM name?")) or return;
	$name =~ s/\W/_/g;
	$name = substr($name, 0, 63); # max length must be < NAME_LEN / 2  where NAME_LEN is 128
	$lvm = bless { disks => [], LVMname => $name }, 'lvm';
	push @$lvms, $lvm;
    }
    $part->{lvm} = $lvm->{LVMname};
    push @{$lvm->{disks}}, $part;
    delete $part->{mntpoint};

    require lvm;
    lvm::check($in) if $::isStandalone;
    lvm::vg_add($part);
    lvm::update_size($lvm);
}
sub Unmount {
    my ($in, $hd, $part) = @_;
    fs::umount_part($part);
}
sub RemoveFromRAID { 
    my ($in, $hd, $part, $all_hds) = @_;
    raid::removeDisk($all_hds->{raids}, $part);
}
sub RemoveFromLVM {
    my ($in, $hd, $part, $all_hds) = @_;
    my $lvms = $all_hds->{lvms};
    isPartOfLVM($part) or die;
    my ($lvm) = grep { $_->{LVMname} eq $part->{lvm} } @$lvms;
    lvm::vg_destroy($lvm);
    @$lvms = grep { $_ != $lvm } @$lvms;
}
sub ModifyRAID { 
    my ($in, $hd, $part, $all_hds) = @_;
    modifyRAID($in, $all_hds->{raids}, $part->{raid});
}
sub Loopback {
    my ($in, $hd, $real_part, $all_hds) = @_;

    write_partitions($in, $hd) or return;

    my $handle = any::inspect($real_part) or $in->ask_warn('', _("This partition can't be used for loopback")), return;

    my ($min, $max) = (1, loopback::getFree($handle->{dir}, $real_part)); 
    my $part = { maxsize => $max, size => 0, loopback_device => $real_part, notFormatted => 1 };
    if (!fsedit::suggest_part($part, $all_hds)) {
	$part->{size} = $part->{maxsize};
	$part->{type} ||= 0x483;
    }
    delete $part->{mntpoint}; # we don't want the suggested mntpoint

    my $type = type2name($part->{type});
    my $mb_size = $part->{size} >> 11;
    $in->ask_from(_("Loopback"), '', [
		  { label => _("Loopback file name: "), val => \$part->{loopback_file} },
		  { label => _("Size in MB: "), val => \$mb_size, min => $min >> 11, max => $max >> 11, type => 'range' },
		  { label => _("Filesystem type: "), val => \$type, list => [ partition_table::important_types() ], not_edit => !$::expert, sort => 0 },
             ],
	     complete => sub {
		 $part->{loopback_file} or $in->ask_warn('', _("Give a file name")), return 1, 0;
		 $part->{loopback_file} =~ s|^([^/])|/$1|;
		 if (my $size = loopback::verifFile($handle->{dir}, $part->{loopback_file}, $real_part)) {
		     $size == -1 and $in->ask_warn('', _("File already used by another loopback, choose another one")), return 1, 0;
		     $in->ask_yesorno('', _("File already exists. Use it?")) or return 1, 0;
		     delete $part->{notFormatted};
		     $part->{size} = divide($size, 512);
		 } else {
		     $part->{size} = from_Mb($mb_size, $min, $max);
		 }
		 0;
	     }) or return;
    $part->{type} = name2type($type);
    push @{$real_part->{loopback}}, $part;
    fsedit::recompute_loopbacks($all_hds);
}

sub Options {
    my ($in, $hd, $part, $all_hds) = @_;

    my @simple_options = qw(user noauto supermount);

    my (undef, $user_implies) = fs::mount_options();
    my ($options, $unknown) = fs::mount_options_unpack($part);
    my %help = fs::mount_options_help(keys %$options);

    my $prev_user = $options->{user};
    $in->ask_from(_("Mount options"),
		  '',
		  [ 
		   (map {; 
			 { label => $_, text => scalar warp_text(formatAlaTeX($help{$_})), val => \$options->{$_}, 
			   advanced => !$part->{rootDevice} && !member($_, @simple_options), if_(!/=$/, type => 'bool'), }
		     } keys %$options),
		    { label => _("Various"), val => \$unknown, advanced => 1 },
		  ],
		  changed => sub {
		      if ($prev_user != $options->{user}) {
			  $prev_user = $options->{user};
			  $options->{$_} = $options->{user} foreach @$user_implies;
		      }
		      if ($options->{encrypted}) {
			  # modify $part->{options} for the check
			  local $part->{options};
			  fs::mount_options_pack($part, $options, $unknown);
			  if (!check($in, $hd, $part, $all_hds)) {
			      $options->{encrypted} = 0;
			  } elsif (!$part->{encrypt_key} && !isSwap($part)) {
			      if (my $encrypt_key = choose_encrypt_key($in)) {
				  $options->{'encryption='} = 'AES128';
				  $part->{encrypt_key} = $encrypt_key;
			      } else {
				  $options->{encrypted} = 0;
			      }
			  }
		      } else {
			  delete $options->{'encryption='};
			  delete $part->{encrypt_key};
		      }
		  },
		 ) or return;

    fs::mount_options_pack($part, $options, $unknown);
}


{ 
    no strict; 
    *{"Toggle to normal mode"} = sub { $::expert = 0 };
    *{"Toggle to expert mode"} = sub { $::expert = 1 };
    *{"Clear all"} = *Clear_all;
    *{"Auto allocate"} = *Auto_allocate;
    *{"Mount point"} = *Mount_point;
    *{"Modify RAID"} = *ModifyRAID;
    *{"Add to RAID"} = *Add2RAID;
    *{"Remove from RAID"} = *RemoveFromRAID; 
    *{"Add to LVM"} = *Add2LVM;
    *{"Remove from LVM"} = *RemoveFromLVM; 
    *{"Use for loopback"} = *Loopback;
    *{"Hard drive information"} = *Hd_info;
}


################################################################################
# helpers
################################################################################

sub is_part_existing {
    my ($part, $all_hds) = @_;
    $part && grep { fsedit::is_same_part($part, $_) } fsedit::get_all_fstab_and_holes($all_hds);
}

sub modifyRAID {
    my ($in, $raids, $nb) = @_;
    my $md = "md$nb";
    $in->ask_from('', '',
		  [
{ label => _("device"), val => \$md, list => [ map { "md$_" } grep { $nb == $_ || !$raids->[$_] } 0..8 ] },
{ label => _("level"), val => \$raids->[$nb]{level}, list => [ qw(0 1 4 5 linear) ] },
{ label => _("chunk size"), val => \$raids->[$nb]{'chunk-size'} },
		  ],
		 ) or return;
    raid::updateSize($raids->[$nb]); # changing the raid level changes the size available
    raid::changeNb($raids, $nb, first($md =~ /(\d+)/));
}


sub ask_alldatamaybelost {
    my ($in, $part, $msg) = @_;

    maybeFormatted($part) or return 1;

    #- here we may have a non-formatted or a formatted partition
    #- -> doing as if it was formatted
    $in->ask_okcancel(_("Read carefully!"), [ _("Be careful: this operation is dangerous."), _($msg, $part->{device}) ], 1);
}
sub ask_alldatawillbelost {
    my ($in, $part, $msg) = @_;

    maybeFormatted($part) or return 1;

    #- here we may have a non-formatted or a formatted partition
    #- -> doing as if it was formatted
    $in->ask_okcancel(_("Read carefully!"), _($msg, $part->{device}), 1);
}

sub partitions_suggestions {
    my ($in) = @_;
    my $t = $::expert ? 
      $in->ask_from_list_('', _("What type of partitioning?"), [ keys %fsedit::suggestions ]) :
      'simple';
    $fsedit::suggestions{$t};
}

sub check_type {
    my ($in, $type, $hd, $part) = @_;
    eval { fsedit::check_type($type, $hd, $part) };
    if (my $err = $@) {
	$in->ask_warn('', $err);
	return;
    }
    if ($::isStandalone) {
	if (my $pkg = fsedit::package_needed_for_partition_type({ type => $type })) {
	    my $fs = type2fs({ type => $type });
	    if (!-x "/sbin/mkfs.$fs") {
		$in->ask_yesorno('', _("The package %s is needed. Install it?", $pkg), 1) or return;
		$in->do_pkgs->install($pkg);
	    }
	    -x "/sbin/mkfs.$fs" or $in->ask_warn('', "Mandatory package $pkg is missing"), return;
	}
    }
    1;
}
sub check_mntpoint {
    my ($in, $mntpoint, $hd, $part, $all_hds) = @_;
    eval { fsedit::check_mntpoint($mntpoint, $hd, $part, $all_hds) };
    local $_ = $@;
    if (m|/boot ending on cylinder > 1024|) {
	$in->ask_warn('',
_("Sorry I won't accept to create /boot so far onto the drive (on a cylinder > 1024).
Either you use LILO and it won't work, or you don't use LILO and you don't need /boot"));
    } elsif (m|/ ending on cylinder > 1024|) {
	$in->ask_warn('',
_("The partition you've selected to add as root (/) is physically located beyond
the 1024th cylinder of the hard drive, and you have no /boot partition.
If you plan to use the LILO boot manager, be careful to add a /boot partition"));
	undef $_;
    } elsif (m|raid / with no /boot|) {
	$in->ask_warn('',
_("You've selected a software RAID partition as root (/).
No bootloader is able to handle this without a /boot partition.
So be careful to add a /boot partition"));
	undef $_;
    } elsif ($_) {
	$in->ask_warn('', formatError($_));
    }
    !$_;
}
sub check {
    my ($in, $hd, $part, $all_hds) = @_;
    check_type($in, $part->{type}, $hd, $part) &&
      check_mntpoint($in, $part->{mntpoint}, $hd, $part, $all_hds);
}

sub write_partitions {
    my ($in, $hd) = @_;
    $hd->{isDirty} or return 1;
    isLVM($hd) and return 1;

    $in->ask_okcancel(_("Read carefully!"), _("Partition table of drive %s is going to be written to disk!", $hd->{device}), 1) or return;
    if (!$::testing) {
	partition_table::write($hd);
    }
    $hd->{rebootNeeded} and die _("You'll need to reboot before the modification can take place");
    1;
}

sub unmount {
    my ($hd, $part) = @_;
    fs::umount_part($part);
}
sub format_ {