From 0797bea2feb6642fc44a49fee581bcdb39a4375d Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Wed, 7 Feb 2001 13:46:18 +0000 Subject: (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 --- perl-install/bootloader.pm | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'perl-install/bootloader.pm') 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}}; -- cgit v1.2.1