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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
|
$o->{autoExitInstall} = 1;
$o->{build_live_system} = 1;
$o->{desktop} = 'KDE';
$o->{autologin} = ${$o->{users}}[0]->{name};
my %cmdline;
my $opt; foreach (@ARGV) {
if (/^--?(.*)/) {
$cmdline{$opt} = 1 if $opt;
$opt = $1;
} else {
$cmdline{$opt} = $_ if $opt;
$opt = '';
}
} $cmdline{$opt} = 1 if $opt;
exists $cmdline{langs} and $o->{locale}{langs} = +{ map { $_ => 1 } split(':', $cmdline{langs}) };
use install_any;
package install_any;
undef *ejectCdrom;
*ejectCdrom = sub {};
use pkgs;
package pkgs;
undef *read_rpmsrate;
*read_rpmsrate = sub {
my ($packages, $rpmsrate_flags_chosen, $f) = @_;
my ($rates, $flags, $need_to_copy) = read_rpmsrate_raw($f);
foreach (keys %$flags) {
my $p = packageByName($packages, $_) or next;
my @flags = (@{$flags->{$_}}, map { if_(/locales-(.*)/, qq(LOCALES"$1")) } $p->requires_nosense);
@flags = map {
my ($user_flags, $known_flags) = partition { /^!?CAT_/ } split('\|\|', $_);
my $ok = find {
my $inv = s/^!//;
$inv xor do {
if (my ($p) = /^HW"(.*)"/) {
return $::o->{build_live_system} ? !$inv : detect_devices::matching_desc__regexp($p);
} elsif (($p) = /^HW_CAT"(.*)"/) {
return $::o->{build_live_system} ? !$inv : modules::probe_category($p);
} elsif (($p) = /^DRIVER"(.*)"/) {
return $::o->{build_live_system} ? !$inv : detect_devices::matching_driver__regexp($p);
} elsif (($p) = /^TYPE"(.*)"/) {
return $::o->{build_live_system} ? !$inv : detect_devices::matching_type($p);
} else {
$rpmsrate_flags_chosen->{$_};
}
};
} @$known_flags;
$ok ? 'TRUE' : @$user_flags ? join('||', @$user_flags) : 'FALSE';
} @flags;
$p->set_rate($rates->{$_});
$p->set_rflags(member('FALSE', @flags) ? 'FALSE' : @flags);
}
push @{$packages->{needToCopy} ||= []}, @$need_to_copy;
};
undef *bestKernelPackage;
*bestKernelPackage = sub {
my ($packages) = @_;
my @kernels = packages2kernels($packages) or internal_error('no kernel available');
my ($version_BOOT) = c::kernel_version() =~ /^(\d+\.\d+)/;
if (my @l = grep { $_->{version} =~ /\Q$version_BOOT/ } @kernels) {
#- favour versions corresponding to current BOOT version
@kernels = @l;
}
my @preferred_exts =
$::o->{build_live_system} ? '-i586-up-1GB' :
detect_devices::is_xbox() ? '-xbox' :
detect_devices::is_i586() ? '-i586-up-1GB' :
!detect_devices::has_cpu_flag('pae') ? ('-i686-up-4GB', '-i586-up-1GB') :
detect_devices::hasSMP() ? '-smp' :
'';
foreach my $prefered_ext (@preferred_exts, '') {
if (my @l = grep { $_->{ext} eq $prefered_ext } @kernels) {
@kernels = @l;
}
}
log::l("bestKernelPackage (" . join(':', @preferred_exts) . "): " . join(' ', map { $_->{pkg}->name } @kernels) . (@kernels > 1 ? ' (choosing the first)' : ''));
$preferred{'kernel-source-' . $kernels[0]{version}} = undef;
$kernels[0]{pkg};
};
undef *selected_leaves;
*selected_leaves = sub {
my ($packages) = @_;
my $provides = $packages->{provides};
my @l = grep { $_->flag_requested || $_->flag_installed } @{$packages->{depslist}};
my %required_ids;
foreach my $pkg (@l) {
foreach my $req ($pkg->requires_nosense) {
my $h = $provides->{$req} or next;
my @provides = my ($provide) = keys %$h;
@provides == 1 or next;
if ($provide != (exists $required_ids{$pkg->id} ? $required_ids{$pkg->id} : $pkg->id)) {
# log::l($packages->{depslist}[$provide]->name . " is not a leaf because required by " . $pkg->name . " (through require $req)");
#- $pkg requires $req, provided by $provide, so we can skip $provide
$required_ids{$provide} = $pkg->id;
}
}
}
[ map { $_->name } grep { ! exists $required_ids{$_->id} } @l ];
};
use install_steps;
package install_steps;
my $old = \&configureNetwork;
undef *configureNetwork;
*configureNetwork = sub {
my ($o) = @_;
if ($o->{build_live_system}) {
require network::ethernet;
network::ethernet::install_dhcp_client($o, undef);
}
&$old;
};
undef *doPartitionDisksAfter;
*doPartitionDisksAfter = sub {
my ($o) = @_;
if (!$::testing) {
my $hds = $o->{all_hds}{hds};
partition_table::write($_) foreach @$hds;
$_->{rebootNeeded} and $o->rebootNeeded foreach @$hds;
}
fs::set_removable_mntpoints($o->{all_hds});
fs::mount_options::set_all_default($o->{all_hds}, %$o, lang::fs_options($o->{locale}))
if !$o->{isUpgrade};
$o->{fstab} = [ fs::get::fstab($o->{all_hds}) ];
if ($::local_install) {
my $p = fs::get::mntpoint2part($::prefix, [ fs::read_fstab('', '/proc/mounts') ]);
my $part = fs::get::device2part($p->{device}, $o->{fstab}) || $o->{fstab}[0];
$part->{mntpoint} = '/';
$part->{isMounted} = 1;
}
fs::get::root_($o->{fstab}) or die "Oops, no root partition";
if (arch() =~ /ppc/ && detect_devices::get_mac_generation() =~ /NewWorld/) {
die "Need bootstrap partition to boot system!" if !(defined $partition_table::mac::bootstrap_part);
}
if (arch() =~ /ia64/ && !fs::get::has_mntpoint("/boot/efi", $o->{all_hds})) {
die N("You must have a FAT partition mounted in /boot/efi");
}
if ($o->{partitioning}{use_existing_root}) {
#- ensure those partitions are mounted so that they are not proposed in choosePartitionsToFormat
fs::mount::part($_) foreach sort { $a->{mntpoint} cmp $b->{mntpoint} }
grep { $_->{mntpoint} && maybeFormatted($_) } @{$o->{fstab}};
}
cat_("/proc/mounts") =~ m|(\S+)\s+/tmp/nfsimage| &&
!any { $_->{mntpoint} eq "/mnt/nfs" } @{$o->{all_hds}{nfss}} and
push @{$o->{all_hds}{nfss}}, { fs_type => 'nfs', mntpoint => "/mnt/nfs", device => $1, options => "noauto,ro,nosuid,soft,rsize=8192,wsize=8192" };
};
use network::network;
package network::network;
undef *write_zeroconf;
*write_zeroconf = sub {
my ($net, $in) = @_;
my $zhostname = $net->{zeroconf}{hostname};
my $file = $::prefix . $tmdns_file;
if ($zhostname) {
$in->do_pkgs->ensure_binary_is_installed('tmdns', 'tmdns', 'auto') if !$in->do_pkgs->is_installed('bind');
$in->do_pkgs->ensure_binary_is_installed('zcip', 'zcip', 'auto');
}
#- write blank hostname even if disabled so that drakconnect does not assume zeroconf is enabled
eval { substInFile { s/^\s*(hostname)\s*=.*/$1 = $zhostname/ } $file } if $zhostname || -f $file;
require services;
services::set_status('tmdns', $net->{zeroconf}{hostname}, $::isInstall);
};
use Xconfig::card;
package Xconfig::card;
#- don't create (potentially broken) ld.so.conf.d files for X drivers
#- anyway we don't want to configure it for the live system
undef *libgl_config;
*libgl_config = sub {};
|