From c969e8f1ffb9c9cb8697192021779f077e38a94b Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Mon, 2 Dec 2002 17:07:52 +0000 Subject: use any::runlevel() --- perl-install/bootlook.pm | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) (limited to 'perl-install') diff --git a/perl-install/bootlook.pm b/perl-install/bootlook.pm index 3094be84c..d1943ec76 100644 --- a/perl-install/bootlook.pm +++ b/perl-install/bootlook.pm @@ -47,7 +47,7 @@ my @usernames; parse_etc_passwd(); my $no_bootsplash; -my $x_mode = isXlaunched(); +my $x_mode = any::runlevel() == 5; my $a_mode = -e "/etc/aurora/Monitor" ? 1 : 0; my $l_mode = isAutologin(); my %auto_mode = get_autologin(""); @@ -337,7 +337,7 @@ Click on Configure to launch the setup wizard.", $lilogrub), ) ), gtkadd(gtkset_layout(new Gtk::HButtonBox, 'end'), - gtksignal_connect(new Gtk::Button(N("OK")), clicked => sub { updateInit(); updateAutologin(); updateAurora(); $::isEmbedded ? kill('USR1',$::CCPID) : Gtk->exit(0) }), + gtksignal_connect(new Gtk::Button(N("OK")), clicked => sub { any::runlevel($x_mode ? 5 : 3); updateAutologin(); updateAurora(); $::isEmbedded ? kill('USR1',$::CCPID) : Gtk->exit(0) }), gtksignal_connect(new Gtk::Button(N("Cancel")), clicked => sub { $::isEmbedded ? kill('USR1', $::CCPID) : Gtk->exit(0) }) ) ) @@ -389,26 +389,6 @@ sub print_hello { print("mcdtg !\n"); } -#------------------------------------------------------------- -# launch X functions -#------------------------------------------------------------- - -sub isXlaunched { - my $line; - local *INITTAB; - open INITTAB, "/etc/inittab" or die N("can not open /etc/inittab for reading: %s", $!); - while () { - if (/id:([1-6]):initdefault:/) { $line = $_; last } - } - $line =~ s/id:([1-6]):initdefault:/$1/; - return $line-3; -} - -sub updateInit { - my $runlevel = $x_mode ? 5 : 3; - substInFile { s/^id:\d:initdefault:\s*$/id:$runlevel:initdefault:\n/ } "/etc/inittab"; -} - #------------------------------------------------------------- # aurora functions #------------------------------------------------------------- -- cgit v1.2.1