summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2001-02-07 13:46:18 +0000
committerPascal Rigaux <pixel@mandriva.com>2001-02-07 13:46:18 +0000
commit0797bea2feb6642fc44a49fee581bcdb39a4375d (patch)
tree29230039fb7310992a9cf6061037f981366caf94
parentc6d13ec24a8c2f7eebf1db8af05330e755248f10 (diff)
downloaddrakx-0797bea2feb6642fc44a49fee581bcdb39a4375d.tar
drakx-0797bea2feb6642fc44a49fee581bcdb39a4375d.tar.gz
drakx-0797bea2feb6642fc44a49fee581bcdb39a4375d.tar.bz2
drakx-0797bea2feb6642fc44a49fee581bcdb39a4375d.tar.xz
drakx-0797bea2feb6642fc44a49fee581bcdb39a4375d.zip
(suggest): read CLEAN_TMP from sysconfig/system, default value of memsize
if given (install): save CLEAN_TMP in sysconfig/system (get_append, add_append): get or set an append value (has_profiles, set_profiles): get or add an entry office for profiles, also add prof=Home in the default entry
-rw-r--r--perl-install/bootloader.pm40
1 files changed, 40 insertions, 0 deletions
diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm
index 0d33fb8ca..e1e43b41c 100644
--- a/perl-install/bootloader.pm
+++ b/perl-install/bootloader.pm
@@ -168,6 +168,19 @@ sub add_kernel($$$$$) {
$v;
}
+sub get_append {
+ my ($b, $key) = @_;
+ ($b->{perImageAppend} =~ /\b$key=(\S*)/)[0];
+}
+sub add_append {
+ my ($b, $key, $val) = @_;
+
+ foreach ({ append => $b->{perImageAppend} }, @{$b->{entries}}) {
+ $_->{append} =~ s/\b$key=\S*\s*//;
+ $_->{append} =~ s/\s*$/ $key=$val)/ if $val;
+ }
+}
+
sub configure_entry($$) {
my ($prefix, $entry) = @_;
if ($entry->{type} eq 'image') {
@@ -244,6 +257,10 @@ wait %d seconds for default boot.
}
}
+
+ add2hash_($lilo, { getVarsFromSh("$prefix/etc/sysconfig/system") }); #- for CLEAN_TMP
+ add2hash_($lilo, { memsize => $1 }) if cat_("/proc/cmdline") =~ /mem=(\S+)/;
+
my $isSecure = -e "$prefix/boot/vmlinuz-${kernelVersion}secure";
my $isSMP = detect_devices::hasSMP();
@@ -342,6 +359,25 @@ sub keytable($$) {
$f && -r "$prefix/$f" && $f;
}
+sub has_profiles { bool(get_label("office", $b)) }
+sub set_profiles {
+ my ($b, $want_profiles) = @_;
+
+ my $office = get_label("office", $b);
+ if ($want_profiles xor $office) {
+ my $e = get_label("linux", $b);
+ if ($want_profiles) {
+ push @{$b->{entries}}, { %$e, label => "office", append => "$e->{append} prof=Office" };
+ $e->{append} .= " prof=Home";
+ } else {
+ # remove profiles
+ $e->{append} =~ s/\s*prof=\w+//;
+ @{$b->{entries}} = grep { $_ != $office } @{$b->{entries}};
+ }
+ }
+
+}
+
sub install_silo($$$) {
my ($prefix, $silo, $fstab) = @_;
my $boot = fsedit::get_root($fstab, 'boot')->{device};
@@ -711,6 +747,10 @@ IconIndex=0
sub install {
my ($prefix, $lilo, $fstab, $hds) = @_;
+ {
+ my $f = "$prefix/etc/sysconfig/system";
+ setVarsInSh($f, add2hash_({ CLEAN_TMP => $lilo->{CLEAN_TMP} }, { getVarsFromSh($f) }));
+ }
$lilo->{keytable} = keytable($prefix, $lilo->{keytable});
my %l = grep_each { $::b } %{$lilo->{methods}};