diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2000-02-21 17:59:09 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2000-02-21 17:59:09 +0000 |
commit | c18552d7a02dfc62ce43160b58db8ad606085cee (patch) | |
tree | f61e497217998ebf66bc727ea95c8416d131144a /perl-install | |
parent | 00845c290fbfdf0015871323b10b3d90af613fca (diff) | |
download | drakx-c18552d7a02dfc62ce43160b58db8ad606085cee.tar drakx-c18552d7a02dfc62ce43160b58db8ad606085cee.tar.gz drakx-c18552d7a02dfc62ce43160b58db8ad606085cee.tar.bz2 drakx-c18552d7a02dfc62ce43160b58db8ad606085cee.tar.xz drakx-c18552d7a02dfc62ce43160b58db8ad606085cee.zip |
no_comment
Diffstat (limited to 'perl-install')
-rw-r--r-- | perl-install/ChangeLog | 8 | ||||
-rw-r--r-- | perl-install/install2.pm | 10 | ||||
-rw-r--r-- | perl-install/install_steps_gtk.pm | 22 | ||||
-rw-r--r-- | perl-install/install_steps_interactive.pm | 7 | ||||
-rw-r--r-- | perl-install/interactive.pm | 17 | ||||
-rw-r--r-- | perl-install/interactive_gtk.pm | 10 | ||||
-rw-r--r-- | perl-install/interactive_newt.pm | 7 | ||||
-rw-r--r-- | perl-install/services.pm | 107 | ||||
-rwxr-xr-x | perl-install/standalone/drakxservices | 29 |
9 files changed, 173 insertions, 44 deletions
diff --git a/perl-install/ChangeLog b/perl-install/ChangeLog index 21fa10787..6e293831a 100644 --- a/perl-install/ChangeLog +++ b/perl-install/ChangeLog @@ -1,3 +1,11 @@ +2000-02-21 Pixel <pixel@mandrakesoft.com> + + * interactive.pm: add ask_many_from_list_with_help and + ask_many_from_list_with_help_ref + + * services.pm: creation. Handle what was in + standalone/drakxservices + 2000-02-18 Pixel <pixel@mandrakesoft.com> * install_steps_gtk.pm (createXconf): added /dev/ (X wants diff --git a/perl-install/install2.pm b/perl-install/install2.pm index 68846bcaa..3c7e89b27 100644 --- a/perl-install/install2.pm +++ b/perl-install/install2.pm @@ -54,7 +54,7 @@ my (%installSteps, @orderedInstallSteps); configureNetwork => [ __("Configure networking"), 1, 1, 'beginner', "formatPartitions" ], installCrypto => [ __("Cryptographic"), 1, 1, '!expert', "configureNetwork" ], configureTimezone => [ __("Configure timezone"), 1, 1, '', "doInstallStep" ], -#- configureServices => [ __("Configure services"), 0, 0, '' ], + configureServices => [ __("Configure services"), 1, 1, '!expert', "doInstallStep" ], configurePrinter => [ __("Configure printer"), 1, 0, '', "doInstallStep" ], setRootPassword => [ __("Set root password"), 1, 1, '', "formatPartitions" ], addUser => [ __("Add a user"), 1, 1, '', "doInstallStep" ], @@ -430,13 +430,9 @@ sub configureTimezone { $o->timeConfig($f, $clicked); } #------------------------------------------------------------------------------ -sub configureServices { - return if $o->{lnx4win}; - - $o->servicesConfig; -} +sub configureServices { $o->servicesConfig } #------------------------------------------------------------------------------ -sub configurePrinter { $o->printerConfig } +sub configurePrinter { $o->printerConfig } #------------------------------------------------------------------------------ sub setRootPassword { return if $o->{isUpgrade}; diff --git a/perl-install/install_steps_gtk.pm b/perl-install/install_steps_gtk.pm index 8a20550f9..557a9cab3 100644 --- a/perl-install/install_steps_gtk.pm +++ b/perl-install/install_steps_gtk.pm @@ -33,11 +33,13 @@ use lang; my $w_help; my $itemsNB = 1; my (@background1, @background2); -my ($width, $height) = (640, 480); -my ($stepswidth, $stepsheight) = (140, $height); -my ($logowidth, $logoheight) = ($width - $stepswidth, 40); -my ($helpwidth, $helpheight) = ($width - $stepswidth, 100); -my ($windowwidth, $windowheight) = ($width - $stepswidth, $height - $helpheight - $logoheight); + +#- initialised in function init_sizes +my ($width, $height); +my ($stepswidth, $stepsheight); +my ($logowidth, $logoheight); +my ($helpwidth, $helpheight); +my ($windowwidth, $windowheight); my @themes_vga16 = qw(blue blackwhite savane); my @themes = qw(DarkMarble marble3d blueHeart); @@ -219,6 +221,7 @@ sub new($$) { } @themes = @themes_vga16 if $o->{simple_themes} || $o->{vga16}; + init_sizes(); install_theme($o); create_logo_window($o); @@ -772,6 +775,15 @@ sub create_logo_window() { $o->{logo_window} = $w; } +sub init_sizes() { +# ($height, $width) = (480, 640); + ($height, $width) = my_gtk::gtkroot()->get_size; + ($stepswidth, $stepsheight) = (140, $height); + ($logowidth, $logoheight) = ($width - $stepswidth, 40); + ($helpwidth, $helpheight) = ($width - $stepswidth, 100); + ($windowwidth, $windowheight) = ($width - $stepswidth, $height - $helpheight - $logoheight); +} + #------------------------------------------------------------------------------ sub createXconf($$$) { my ($file, $mouse_type, $mouse_dev, $wacom_dev) = @_; diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm index 731c6ba3d..261fc0d47 100644 --- a/perl-install/install_steps_interactive.pm +++ b/perl-install/install_steps_interactive.pm @@ -24,6 +24,7 @@ use raid; use mouse; use modules; use lang; +use any; use keyboard; use fs; use log; @@ -551,7 +552,11 @@ sub timeConfig { } #------------------------------------------------------------------------------ -#-sub servicesConfig {} +sub servicesConfig { + my ($o) = @_; + any::drakxservices($o, $o->{prefix}); +} + #------------------------------------------------------------------------------ sub printerConfig($) { my ($o) = @_; diff --git a/perl-install/interactive.pm b/perl-install/interactive.pm index 79df5be2c..ac8ced5a2 100644 --- a/perl-install/interactive.pm +++ b/perl-install/interactive.pm @@ -112,12 +112,17 @@ sub ask_from_list2($$$$;$) { $o->ask_from_listW($title, [ deref($message) ], $l, $def || $l->[0]); } -sub ask_many_from_list_ref($$$$;$) { +sub ask_many_from_list_ref { my ($o, $title, $message, $l, $val) = @_; return 1 if @$l == 0; $o->ask_many_from_list_refW($title, [ deref($message) ], $l, $val); } -sub ask_many_from_list($$$$;$) { +sub ask_many_from_list_with_help_ref { + my ($o, $title, $message, $l, $help, $val) = @_; + return 1 if @$l == 0; + $o->ask_many_from_list_with_help_refW($title, [ deref($message) ], $l, $help, $val); +} +sub ask_many_from_list { my ($o, $title, $message, $l, $def) = @_; my $val = [ map { my $i = $_; \$i } @$def ]; @@ -125,6 +130,14 @@ sub ask_many_from_list($$$$;$) { $o->ask_many_from_list_ref($title, $message, $l, $val) ? [ map { $$_ } @$val ] : undef; } +sub ask_many_from_list_with_help { + my ($o, $title, $message, $l, $help, $def) = @_; + + my $val = [ map { my $i = $_; \$i } @$def ]; + + $o->ask_many_from_list_with_help_ref($title, $message, $l, $help, $val) ? + [ map { $$_ } @$val ] : undef; +} sub ask_from_entry { my ($o, $title, $message, $label, $def, %callback) = @_; diff --git a/perl-install/interactive_gtk.pm b/perl-install/interactive_gtk.pm index 41338477a..4b99d47d0 100644 --- a/perl-install/interactive_gtk.pm +++ b/perl-install/interactive_gtk.pm @@ -53,13 +53,20 @@ sub ask_from_listW { $r or die "ask_from_list cancel"; } -sub ask_many_from_list_refW($$$$$) { +sub ask_many_from_list_refW { my ($o, $title, $messages, $list, $val) = @_; + ask_many_from_list_with_help_refW($o, $title, $messages, $list, undef, $val) +} + +sub ask_many_from_list_with_help_refW { + my ($o, $title, $messages, $list, $help, $val) = @_; my $w = my_gtk->new('', %$o); + my $tips = new Gtk::Tooltips; my $box = gtkpack(new Gtk::VBox(0,0), map_index { my $i = $::i; my $o = Gtk::CheckButton->new($_); + $tips->set_tip($o, $help->[$i]) if $help->[$i]; $o->set_active(${$val->[$i]}); $o->signal_connect(clicked => sub { invbool \${$val->[$i]} }); $o; @@ -74,7 +81,6 @@ sub ask_many_from_list_refW($$$$$) { $w->main && $val; } - sub ask_from_entries_refW { my ($o, $title, $messages, $l, $val, %hcallback) = @_; my ($title_, @okcancel) = deref($title); diff --git a/perl-install/interactive_newt.pm b/perl-install/interactive_newt.pm index 6fbc18d3c..3a00a36b0 100644 --- a/perl-install/interactive_newt.pm +++ b/perl-install/interactive_newt.pm @@ -78,7 +78,12 @@ sub ask_from_listW { } } -sub ask_many_from_list_refW($$$$$) { +sub ask_many_from_list_with_help_refW { + my ($o, $title, $messages, $list, $help, $val) = @_; + ask_many_from_list_refW($o, $title, $messages, $list, $val); +} + +sub ask_many_from_list_refW { my ($o, $title, $messages, $list, $val) = @_; my $height = min(int @$list, 18); diff --git a/perl-install/services.pm b/perl-install/services.pm new file mode 100644 index 000000000..6e838cc05 --- /dev/null +++ b/perl-install/services.pm @@ -0,0 +1,107 @@ +package services; + +use diagnostics; +use strict; + +#-###################################################################################### +#- misc imports +#-###################################################################################### +use common qw(:common :functional :system :file); +use commands; +use run_program; + +my %services = ( +anacron => __("Anacron a periodic command scheduler."), +apmd => __("apmd is used for monitoring batery status and logging it via +syslog(8). It can also be used for shutting down the machine when the battery is +low."), +atd => __("Runs commands scheduled by the at command at the time specified when +at was run, and runs batch commands when the load average is low enough."), +crond => __("cron is a standard UNIX program that runs user-specified programs +at periodic scheduled times. vixie cron adds a number of features to the basic +UNIX cron, including better security and more powerful configuration options."), +gpm => __("GPM adds mouse support to text-based Linux applications such the +Midnight Commander. Is also allows mouse-based console cut-and-paste operations, +and includes support for pop-up menus on the console."), +httpd => __("Apache is a World Wide Web server. It is used to serve HTML files +and CGI."), +inet => __("The internet superserver daemon (commonly called inetd) starts a +variety of other internet services as needed. It is responsible for starting +many services, including telnet, ftp, rsh, and rlogin. Disabling inetd disables +all of the services it is responsible for."), +keytable => __("This package loads the selected keyboard map as set in +/etc/sysconfig/keyboard. This can be selected using the kbdconfig utility. You +should leave this enabled for most machines."), +lpd => __("lpd is the print daemon required for lpr to work properly. It is +basically a server that arbitrates print jobs to printer(s)."), +named => __("named (BIND) is a Domain Name Server (DNS) that is used to resolve +host names to IP addresses."), +netfs => __("Mounts and unmounts all Network File System (NFS), SMB (Lan +Manager/Windows), and NCP (NetWare) mount points."), +network => __("Activates/Deactivates all network interfaces configured to start +at boot time."), +nfs => __("NFS is a popular protocol for file sharing across TCP/IP networks. +This service provides NFS server functionality, which is configured via the +/etc/exports file."), +nfslock => __("NFS is a popular protocol for file sharing across TCP/IP +networks. This service provides NFS file locking functionality."), +pcmcia => __("PCMCIA support is usually to support things like ethernet and +modems in laptops. It won't get started unless configured so it is safe to have +it installed on machines that don't need it."), +portmap => __("The portmapper manages RPC connections, which are used by +protocols such as NFS and NIS. The portmap server must be running on machines +which act as servers for protocols which make use of the RPC mechanism."), +postfix => __("Postfix is a Mail Transport Agent, which is the program that +moves mail from one machine to another."), +random => __("Saves and restores system entropy pool for higher quality random +number generation."), +routed => __("The routed daemon allows for automatic IP router table updated via +the RIP protocol. While RIP is widely used on small networks, more complex +routing protocls are needed for complex networks."), +rstatd => __("The rstat protocol allows users on a network to retrieve +performance metrics for any machine on that network."), +rusersd => __("The rusers protocol allows users on a network to identify who is +logged in on other responding machines."), +rwhod => __("The rwho protocol lets remote users get a list of all of the users +logged into a machine running the rwho daemon (similiar to finger)."), +syslog => __("Syslog is the facility by which many daemons use to log messages +to various system log files. It is a good idea to always run syslog."), +usb => __("This startup script try to load your modules for your usb mouse."), +xfs => __("Starts and stops the X Font Server at boot time and shutdown."), +); + +sub drakxservices { + my ($in, $prefix) = @_; + my $cmd = $prefix ? "chroot $prefix" : ""; + my @services = map { [/(\S+)/, /:on/ ] } sort `$cmd chkconfig --list`; + my @l = map { $_->[0] } @services; + my @before = map { $_->[1] } @services; + my @descr = map { + my $s = $services{$_}; + if ($s) { + $s = translate($s); + } else { + ($s = cat_("$prefix/etc/rc.d/init.d/$_")) =~ s/\\\s*\n#\s*//mg; + ($s) = $s =~ /^# description:\s+(.*?)^(?:[^#]|# {0,2}\S)/sm; + $s =~ s/^#\s*//m; + } + $s =~ s/\n/ /gm; $s =~ s/\s+$//; + $s; + } @l; + + my $after = $in->ask_many_from_list_with_help("drakxservices", + _("Choose which services should be automatically started at boot time"), + \@l, \@descr, \@before) or return; + + mapn { + my ($name, $before, $after) = @_; + if ($before != $after) { + run_program::rooted($prefix, "chkconfig", $after ? "--add" : "--del", $name); + if ($after && cat_("$prefix/etc/rc.d/init.d/$name") =~ /^#\s+chkconfig:\s+-/m) { + #- `/sbin/runlevel` =~ /\s(\d+)/ or die "bad runlevel"; + #- $1 == 3 || $1 == 5 or log::l("strange runlevel: ``$1'' (neither 3 nor 5)"); + run_program::rooted($prefix, "chkconfig", "--level", "35", $name, "on"); + } + } + } \@l, \@before, $after; +} diff --git a/perl-install/standalone/drakxservices b/perl-install/standalone/drakxservices index b551055d6..45270a7e7 100755 --- a/perl-install/standalone/drakxservices +++ b/perl-install/standalone/drakxservices @@ -1,9 +1,10 @@ #!/usr/bin/perl -use lib qw(/usr/lib/libDrakX); +use lib qw(.);#(/usr/lib/libDrakX); use common qw(:common :functional :file); use interactive; +use services; use log; local $_ = join '', @ARGV; @@ -12,30 +13,6 @@ local $_ = join '', @ARGV; $::isStandalone = 1; -my $in = vnew interactive('su'); - -my @l = grep { !/\.rpm/ } map { chop; $_ } `cd /etc/rc.d/init.d ; grep -l "chkconfig:" *`; -my @before = map { bool(@_ = glob("/etc/rc.d/rc*.d/S*$_")) } @l; - -my $after = $in->ask_many_from_list("drakxservices", -_("Choose which services should be automatically started at boot time"), - \@l, \@before); - -mapn { - my ($name, $before, $after) = @_; - if ($before != $after) { - if ($after) { - if (cat_("/etc/rc.d/init.d/$name") =~ /^chkconfig:\s+-/m) { - system("chkconfig --add $name"); - } else { - `/sbin/runlevel` =~ /\s(\d+)/ or die "bad runlevel"; - $1 == 3 || $1 == 5 or log::l("strange runlevel: ``$1'' (neither 3 nor 5)"); - system("chkconfig --level $1 $name on"); - } - } else { - system("chkconfig --del $name"); - } - } -} \@l, \@before, $after if $after; +services::drakxservices(my $in = vnew interactive('su')); $in->exit(0); |