From 46e89f1a659a034dc1057a087ae8e6afe454f01d Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Tue, 6 Mar 2001 00:20:34 +0000 Subject: move inittab modifying to any::runlevel --- perl-install/Xconfigurator.pm | 9 +-------- perl-install/any.pm | 11 +++++++++++ perl-install/install_steps.pm | 2 +- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/perl-install/Xconfigurator.pm b/perl-install/Xconfigurator.pm index 18e9a0e23..614d16e91 100644 --- a/perl-install/Xconfigurator.pm +++ b/perl-install/Xconfigurator.pm @@ -136,13 +136,6 @@ sub readMonitorsDB { } } -sub rewriteInittab { - my ($runlevel) = @_; - my $f = "$prefix/etc/inittab"; - -r $f or log::l("missing inittab!!!"), return; - substInFile { s/^(id:)[35](:initdefault:)\s*$/$1$runlevel$2\n/ } $f; -} - sub keepOnlyLegalModes { my ($card, $monitor) = @_; my $mem = 1024 * ($card->{memory} || ($card->{server} eq 'FBDev' ? 2048 : 99999)); @@ -1195,7 +1188,7 @@ Current configuration is: my $run = exists $o->{xdm} ? $o->{xdm} : $::auto || $in->ask_yesorno(_("X at startup"), _("I can set up your computer to automatically start X upon booting. Would you like X to start when you reboot?"), 1); - rewriteInittab($run ? 5 : 3) unless $::testing; + any::runlevel($prefix, $run ? 5 : 3) unless $::testing; } run_program::rooted($prefix, "chkconfig", "--del", "gpm") if $o->{mouse}{device} =~ /ttyS/ && !$::isStandalone; } diff --git a/perl-install/any.pm b/perl-install/any.pm index 34e51c442..eb6fe6418 100644 --- a/perl-install/any.pm +++ b/perl-install/any.pm @@ -781,4 +781,15 @@ sub write_passwd_user { } "$prefix/etc/passwd"; } +sub runlevel { + my ($prefix, $runlevel) = @_; + my $f = "$prefix/etc/inittab"; + -r $f or log::l("missing inittab!!!"), return; + if ($runlevel) { + substInFile { s/^id:\d:initdefault:\s*$/id:$runlevel:initdefault:\n/ } $f; + } else { + cat_($f) =~ /^id:(\d):initdefault:\s*$/ && $1; + } +} + 1; diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm index c6c26b9b3..fd42d811b 100644 --- a/perl-install/install_steps.pm +++ b/perl-install/install_steps.pm @@ -765,7 +765,7 @@ sub configureXAfter { if ($o->{X}{card}{server} eq 'FBDev') { unless (install_any::setupFB($o, Xconfigurator::getVGAMode($o->{X}))) { log::l("disabling automatic start-up of X11 if any as setup framebuffer failed"); - Xconfigurator::rewriteInittab(3) unless $::testing; #- disable automatic start-up of X11 on error. + any::runlevel($o->{prefix}, 3) unless $::testing; #- disable automatic start-up of X11 on error. } } if ($o->{X}{default_depth} >= 16 && $o->{X}{card}{default_wres} >= 1024) { -- cgit v1.2.1