aboutsummaryrefslogtreecommitdiffstats
path: root/BCD/Bcd.pm
blob: 37cd898f3b197a6ebd1f9848bff6895e6972b6ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
package BCD::Bcd;

use strict;
use XML::Simple;
use Data::Dumper;
use Pod::Usage;
use MDK::Common;

use BCD::Resign;
use BCD::Common qw(:DEFAULT $wd $isoconf $name $arch $version $isodir $builddir $error_color $dir_deps);
use BCD::Genisoimage;
use BCD::Isolinux;
use BCD::Stagex;
use BCD::CheckMedia;
use BCD::Media;
use BCD::Web;

our @ISA = qw(Exporter);
our @EXPORT = qw(main_bcd);
our $conf_file;
my $color = "cyan";

sub print_info() {
	print Dumper($isoconf);
}

sub help_bcd {
	pod2usage('-verbose' => 2, '-input' => "bcd.pod", '-pathlist' => @INC);
}

sub do_all {
	my ($option) = @_;
	clean_all;
	check_dir;
	main_isolinux;
	main_stagex;
	main_media($option);
	main_iso($option);
	main_html;
	show_info();
}

sub show_info {
     print "\n";
     print "ISO dir: $isodir\n";
     print "build dir: $builddir\n";
     print "LOG of media: /tmp/$name-$version-$arch\n";
     print "stored URPMQ result: /var/lib/bcd/$name-$version-$arch\n";
     print "\n";
}


sub main_bcd() {
    my %opts = (
	'' => \&help_bcd,
	info => \&print_info,
	iso => \&main_iso,
	idx => \&create_idx,
	md5 => \&create_md5,
	stagex => \&main_stagex,
	isolinux => \&main_isolinux,
	media => \&main_media,
	gendistrib => \&use_gendistrib,
	clean => \&clean_all,
	list => \&list_media,
	mediarepo => \&list_medias_available,
	checkrepo => \&check_repo_hdlist,
        check => \&check_launch,
	doble => \&solve_doble_issue,
	kernel => \&find_all_kernel,
	resign => \&resign_media,
	getsrpm => \&get_srpms_list,
	clean => \&clean_urpmq_log,
	html => \&main_html,
	all => \&do_all,
	);
    


    if (! -d $dir_deps) {
	print_color(" I will create $dir_deps to store all urpmq queries", $error_color);
	print_color(" Please give full access RW to your current user to this directory", $color);
	mkdir_p($dir_deps);
    }
    print_color("-- If you don't want to use previous urpmq query:\n  ++ remove the directory $dir_deps\n  ++ or remove the file wich contains the urpmq result for the package to redo an another one (ie: the file $dir_deps/tocopy_plop_todo_Main-drakconf)", $color);
#    $ARGV[0] or help_bcd;
#    -f $ARGV[0] or die "Cant acces to conf file $ARGV[0]\n";
    if (my $f = $opts{$ARGV[1]}) {
	if ($ARGV[2]) {
		my $options;
		foreach my $arg (2 .. $#ARGV) {
		    $arg and $options = $options . ' ' . $ARGV[$arg];
	    	}
		$f->($options);
	} else {
		$f->();
	}
    } else {
	print_color(" ** Dont know what todo ** \n unknow option", $error_color);
    }
}


1;
8 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
package install2; # $Id$

use diagnostics;
use strict;
use vars qw($o $version);

#-######################################################################################
#- misc imports
#-######################################################################################
use steps;
use common;
use install_any qw(:all);
use install_steps;
use install_any;
use lang;
use keyboard;
use mouse;
use fsedit;
use devices;
use partition_table qw(:types);
use modules;
use detect_devices;
use run_program;
use any;
use log;
use fs;
#-$::corporate=1;


#-#######################################################################################
#-$O
#-the big struct which contain, well everything (globals + the interactive methods ...)
#-if you want to do a kickstart file, you just have to add all the required fields (see for example
#-the variable $default)
#-#######################################################################################
$o = $::o = {
#    bootloader => { linear => 0, message => 1, timeout => 5, restricted => 0 },
#-    packages   => [ qw() ],
    partitioning => { clearall => 0, eraseBadPartitions => 0, auto_allocate => 0 }, #-, readonly => 0 },
    authentication => { md5 => 1, shadow => 1 },
    locale         => { lang => 'en_US' },
#-    isUpgrade    => 0,
    toRemove     => [],
    toSave       => [],
#-    simple_themes => 1,

    timezone => {
#-                   timezone => "Europe/Paris",
#-                   UTC      => 1,
                },
#-    superuser => { password => 'a', shell => '/bin/bash', realname => 'God' },
#-    user => { name => 'foo', password => 'bar', home => '/home/foo', shell => '/bin/bash', realname => 'really, it is foo' },

#-    keyboard => 'de',
#-    display => "192.168.1.19:1",
    steps        => \%steps::installSteps,
    orderedSteps => \@steps::orderedInstallSteps,

#- for the list of fields available for user and superuser, see @etc_pass_fields in install_steps.pm
#-    intf => { eth0 => { DEVICE => "eth0", IPADDR => '1.2.3.4', NETMASK => '255.255.255.128' } },

    netc => {},
    intf => {},
             
#-step : the current one
#-prefix
#-mouse
#-keyboard
#-netc
#-methods
#-packages compss
#-printer haveone entry(cf printer.pm)

};


sub installStepsCall {
    my ($o, $auto, $fun, @args) = @_;
    $fun = "install_steps::$fun" if $auto;
    $o->$fun(@args);
}

#-######################################################################################
#- Steps Functions
#- each step function are called with two arguments : clicked(because if you are a
#- beginner you can force the the step) and the entered number
#-######################################################################################

#------------------------------------------------------------------------------
sub selectLanguage {
    my ($_clicked, $ent_number, $auto) = @_;

    installStepsCall($o, $auto, 'selectLanguage', $ent_number == 1);
}

sub acceptLicense {
    my ($_clicked, $_ent_number, $auto) = @_;
    installStepsCall($o, $auto, 'acceptLicense') if !$o->{useless_thing_accepted};
}

#------------------------------------------------------------------------------
sub selectMouse {
    my ($clicked, $ent_number, $auto) = @_;

    require pkgs;
    my $first_time = $ent_number == 1;

    installStepsCall($o, $auto, 'selectMouse', !$first_time || $clicked);

    addToBeDone { mouse::write($o->do_pkgs, $o->{mouse}) if !$o->{isUpgrade} || $clicked } 'installPackages';
}