From aa5858b87ab4794513743166a4a6f14cee0d0383 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Sun, 29 Dec 2002 12:06:39 +0000 Subject: move any::runlevel() to Xconfig::various::runlevel() --- perl-install/Xconfig/main.pm | 2 +- perl-install/Xconfig/various.pm | 16 +++++++++++++--- perl-install/any.pm | 12 ------------ perl-install/bootlook.pm | 5 +++-- perl-install/install_steps.pm | 2 +- 5 files changed, 18 insertions(+), 19 deletions(-) diff --git a/perl-install/Xconfig/main.pm b/perl-install/Xconfig/main.pm index 6baa84f78..b3d291c07 100644 --- a/perl-install/Xconfig/main.pm +++ b/perl-install/Xconfig/main.pm @@ -43,7 +43,7 @@ sub configure_everything_auto_install { &write($raw_X, $X); - any::runlevel(exists $old_X->{xdm} && !$old_X->{xdm} ? 3 : 5); + Xconfig::various::runlevel(exists $old_X->{xdm} && !$old_X->{xdm} ? 3 : 5); } sub configure_everything { diff --git a/perl-install/Xconfig/various.pm b/perl-install/Xconfig/various.pm index 5b1ae7a45..a89be0373 100644 --- a/perl-install/Xconfig/various.pm +++ b/perl-install/Xconfig/various.pm @@ -7,7 +7,6 @@ use Xconfig::card; use Xconfig::default; use Xconfig::resolution_and_depth; use common; -use any; sub info { @@ -46,9 +45,20 @@ sub various { 1; } +sub runlevel { + my ($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 if !$::testing; + } else { + cat_($f) =~ /^id:(\d):initdefault:\s*$/ && $1; + } +} + sub choose_xdm { my ($in, $auto) = @_; - my $xdm = $::isStandalone ? any::runlevel() == 5 : 1; + my $xdm = $::isStandalone ? runlevel() == 5 : 1; if (!$auto || $::isStandalone) { $in->set_help('configureXxdm') if !$::isStandalone; @@ -57,7 +67,7 @@ sub choose_xdm { N("I can setup your computer to automatically start the graphical interface (XFree) upon booting. Would you like XFree to start when you reboot?"), $xdm) or return; } - any::runlevel($xdm ? 5 : 3); + runlevel($xdm ? 5 : 3); } sub tvout { diff --git a/perl-install/any.pm b/perl-install/any.pm index 62de800ed..ab492be35 100644 --- a/perl-install/any.pm +++ b/perl-install/any.pm @@ -688,18 +688,6 @@ sub set_login_serial_console { substInFile { s/^s$port:.*//; $_ = $line if eof } "$::prefix/etc/inittab"; } - -sub runlevel { - my ($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 if !$::testing; - } else { - cat_($f) =~ /^id:(\d):initdefault:\s*$/ && $1; - } -} - sub report_bug { my ($prefix, @other) = @_; diff --git a/perl-install/bootlook.pm b/perl-install/bootlook.pm index 6021f117a..51f300475 100644 --- a/perl-install/bootlook.pm +++ b/perl-install/bootlook.pm @@ -25,6 +25,7 @@ use Config; use POSIX; use interactive; use standalone; +use Xconfig::various; use any; use bootloader; use fs; @@ -42,7 +43,7 @@ my @usernames; parse_etc_passwd(); my $no_bootsplash; -my $x_mode = any::runlevel() == 5; +my $x_mode = Xconfig::various::runlevel() == 5; my $a_mode = -e "/etc/aurora/Monitor" ? 1 : 0; my $auto_mode = any::get_autologin(); my $inmain = 0; @@ -332,7 +333,7 @@ Click on Configure to launch the setup wizard.", $lilogrub), ) ), gtkadd(gtkset_layout(new Gtk2::HButtonBox, 'end'), - gtksignal_connect(new Gtk2::Button(N("OK")), clicked => sub { any::runlevel($x_mode ? 5 : 3); updateAutologin(); updateAurora(); $::isEmbedded ? kill('USR1',$::CCPID) : Gtk2->exit(0) }), + gtksignal_connect(new Gtk2::Button(N("OK")), clicked => sub { Xconfig::various::runlevel($x_mode ? 5 : 3); updateAutologin(); updateAurora(); $::isEmbedded ? kill('USR1',$::CCPID) : Gtk2->exit(0) }), gtksignal_connect(new Gtk2::Button(N("Cancel")), clicked => sub { $::isEmbedded ? kill('USR1', $::CCPID) : Gtk2->exit(0) }) ) ) diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm index 34503a80e..7f20275cc 100644 --- a/perl-install/install_steps.pm +++ b/perl-install/install_steps.pm @@ -915,7 +915,7 @@ sub configureXAfter { if ($o->{X}{bios_vga_mode}) { install_any::setupFB($o, $o->{X}{bios_vga_mode}) or do { log::l("disabling automatic start-up of X11 if any as setup framebuffer failed"); - any::runlevel(3); #- disable automatic start-up of X11 on error. + Xconfig::various::runlevel(3); #- disable automatic start-up of X11 on error. }; } if ($o->{X}{default_depth} >= 16 && $o->{X}{resolution_wanted} >= 1024) { -- cgit v1.2.1