summaryrefslogtreecommitdiffstats
path: root/move/make_live
blob: ad0c127e7064276c791bf39a77c4ccfc34614acf (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
#!/usr/bin/perl

use lib "../perl-install";
use common;
use pkgs;

my @langs = map { /^../; $& } split /\s/, (cat_('move.pm') =~ /ALLOWED_LANGS = qw\((.*)\)/)[0];

@ARGV == 0 or die "usage: make_live\n";

sub installPackages {
    rename "/etc/rpm/macros", "/etc/rpm/macros.";
    output_p("/etc/rpm/macros", "%_install_langs " . join(":", @langs) . "\n");

    mkdir_p("$::prefix/var/lib/rpm");
    mkdir_p("$::prefix/root/drakx");


    undef *install_any::setDefaultPackages;
    *install_any::setDefaultPackages = sub {};

    undef *install_any::getFile;
    *install_any::getFile = sub {
	my ($f, $o_method) = @_;
	log::l("getFile $f:$o_method");
	open(my $F, '/export/' . install_any::relGetFile($f)) or return;
	$F;
    };
    install_any::setPackages(my $o = $::o = { 
					     prefix => $::prefix, 
					     meta_class => 'desktop', 
					     default_packages => [ qw(XFree86-server XFree86-xfs XFree86-FBDev) ],
					    });

    my %compssUsersChoice = map { $_ => 1 } map { @{$_->{flags}} } values %{$o->{compssUsers}};
    $compssUsersChoice{$_} = 1 foreach 'SYSTEM', 'DVD', 'USB', 'SOUND', 'BURNER', 'UTF8', 'DOCS', 'TV', '3D';
    $compssUsersChoice{qq(LOCALES"$_")} = 1 foreach @langs;

    pkgs::setSelectedFromCompssList($o->{packages}, \%compssUsersChoice, 4, 0);

    my @toInstall = pkgs::packagesToInstall($o->{packages});
    $ENV{DURING_INSTALL} = 1;
    $ENV{LD_LIBRARY_PATH} = "/lib:/usr/lib:/usr/X11R6/lib:/usr/lib/qt3/lib";
    pkgs::install($::prefix, 0, \@toInstall, $o->{packages});

    eval { fs::umount("$::prefix/proc") };

    unlink "/etc/rpm/macros";
    rename "/etc/rpm/macros.", "/etc/rpm/macros";
}

my $cwd = chomp_(`pwd`);
$::prefix = "/tmp/live_tree";

{
    eval { fs::umount("$::prefix/proc") };
#    eval { rm_rf($::prefix) };
    output_p("$::prefix/etc/fstab", "none /proc proc defaults 0 0\n");
    installPackages();
    system("chroot $::prefix ldconfig");
    system("chroot $::prefix update-menus");
    rm_rf("$::prefix/dev"); # we don't need it, we use devfs
}

symlinkf('/var/lib/xkb', "$::prefix/etc/X11/xkb/compiled"); # don't want the relative path, prefering the absolute path
system("find $::prefix/dev -type b -o -type c | xargs chmod a+rw");

substInFile {
    #- /lib is ro, for the moment we don't save, we'll see later if we may want to save (using /var/dev-state for example)
    s|.*lib/dev-state.*||;
} "$::prefix/etc/devfsd.conf";