sysv-rc-conf-0.99/0000755000175000017500000000000010241407120013361 5ustar jfsjfs00000000000000sysv-rc-conf-0.99/ChangeLog0000644000175000017500000000450510240443645015152 0ustar jfsjfs00000000000000Changelog for sysv-rc-conf: Version 0.99 - 2005/05/11 ============ - Normal users can now --list services. Patch by Javier Fernandez-Sanguino Pena - Manual page additions. Patch by Javier Fernandez-Sanguino Pena - Added some more files types to not display. Patch by Javier Fernandez-Sanguino Pena Version 0.98 - 2004/10/02 ============ - Fixed a bug that could cause scripts in init.d to not show up in the list if they didn't have links in any of the rc?.d directories. Version 0.97 - 2004/06/14 ============ - Fixed a bug that crashed the program if there was a service without a K link in the cache and the S priority was above 90. - Usage message for CLI - Documentation fixes. Version 0.96 - 2004/06/04 ============ - Startup time is now much faster. Also submitted a patch for Curses::UI that will shrink memory consumption by about 10% and speed up start time even more for sysv-rc-conf. - Can use chkconfig like syntax to do quick CLI modification - Internal clean up. Version 0.95 - 2004/05/15 ============ - Added support to restore symlinks to original state before sysv-rc-conf was launched. - A few internal changes to speed up the program a bit. Version 0.94 - 2004/04/11 ============ - Added help screen. Version 0.93 - 2004/04/02 ============ - Fixed a bug having to do with figuring out the current rl. Version 0.92 - 2004/03/10 ============ - Added the --order option. Now there is more then one way to order the rows, such as alphabetical (like before), or by priority number of any of the runlevels. Version 0.90 - 2004/03/08 ============ - Added support to start / stop services. - Now you can --show only the runlevels you want to see. - Better algorithm to choose priority in default view. - Reduced memory consumption by a few megs. - Code cleanups - Renamed project to sysv-rc-conf from rc-sysv-conf. Version 0.80 - 2004/03/01 ============ - Initial release. Most stuff is implemented that I want. Once the main items in TODO are out of the way, we'll move to 1.00. sysv-rc-conf-0.99/COPYING0000644000175000017500000003544510017454710014437 0ustar jfsjfs00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS sysv-rc-conf-0.99/Makefile0000644000175000017500000000064010036272654015037 0ustar jfsjfs00000000000000PREFIX = $(DESTDIR)/usr/sbin MANDIR = $(DESTDIR)/usr/share/man/man8 all: man man : pod2man -s 8 -c ' ' ./sysv-rc-conf.pl | gzip -9 -c > sysv-rc-conf.8.gz install : man mkdir -p $(PREFIX) $(MANDIR) install -m755 ./sysv-rc-conf.pl $(PREFIX)/sysv-rc-conf install -m644 ./sysv-rc-conf.8.gz $(MANDIR) uninstall : rm -f $(PREFIX)/sysv-rc-conf rm -f $(MANDIR)/sysv-rc-conf.8.gz clean : rm -f sysv-rc-conf.8.gz sysv-rc-conf-0.99/INSTALL0000644000175000017500000000722310060263150014420 0ustar jfsjfs00000000000000Installation Instructions for sysv-rc-conf ========================================== .5) Debian Users If you're a Debian user sysv-rc-conf is already available. # apt-get install sysv-rc-conf 1) Install required pre-reqs Required libs: ncurses Required Perl modules: Term::ReadKey Curses Curses::UI Optional Perl modules: Test::Pod (For Term::ReadKey tests) 1.1) Package Management Before going through the trouble of installing all of the above packages manually do yourself a favor and see if your systems package management has any or all of these packages. So check those rpms, debs, ebuilds, or what-have-you. 1.5) Manual installation You can get ncurses from Most systems will already have this installed, though you may need to install the "development" version of ncurses. On RPM based Linux distros for instance, this is probably called ncurses-devel. You can get any of the perl modules from CPAN At the time of this writing (Feb 2004) the current version of Curses.pm (version 1.06) fails to compile with Perl 5.8. A new version of Curses is said to be expected soon. This patch will make it compile for now (I got it from perl-Curses-1.06-7mdk.src.rpm) --- Curses-1.06/Curses.c.pix 2001-07-25 19:10:38.000000000 +0200 +++ Curses-1.06/Curses.c 2002-08-05 21:56:07.000000000 +0200 @@ -272,7 +272,7 @@ SV *sv; int argnum; { - if (Perl_sv_isa(sv, "Curses::Window")) { + if (sv_isa(sv, "Curses::Window")) { WINDOW *ret = (WINDOW *)SvIV((SV*)SvRV(sv)); return ret; } So, to install Curses-1.06 with the new patch, and if you saved the patch as Curses-perl5.8-fix.diff, you can do the following: $ tar xzf Curses-1.06.tar.gz $ cd Curses-1.06 $ patch -p1 < ../Curses-perl5.8-fix.diff patching file Curses.c $ perl -pi -e 's#^(my \$libs);$#$1="-lncurses -ltermcap -lform -lmenu";#' \ Makefile.PL $ perl -pi -e 's#^(my \$inc);$#$1="-I/usr/include -I/usr/include/ncurses";#' \ Makefile.PL $ perl Makefile.PL MENUS FORMS $ make # make install You can get Term::ReadKey, Curses, and Curses::UI from any CPAN mirror. The typical way to install most Perl modules applies. # perl -MCPAN -e 'install Term::ReadKey' # perl -MCPAN -e 'install Curses::UI' If you have problems installing Curses::UI with CPAN, try downloading the package and manually running the tests. You'll see they actually do work. For instance, I was getting the following error on the 09label test script when trying to download and install Curses::UI from CPAN: Unable to get Terminal Size. The TIOCGWINSZ ioctl didn't work. The COLUMNS and LINES environment variables didn't work. The resize program didn't work. at /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/Term/ReadKey.pm line 343. But after downloading Curses::UI and manually running the tests $ perl -Mblib t/* Everything passed just fine. So I just did the normal INSTALL procedure listed in Curses::UI's INSTALL file. Hopefully that covers all weird cases when trying to install these packages. If you have any more insight, feedback would be appreciated. Okay, you should be done with the manual installation of the pre-reqs. 2) Edit the Makefile By default sysv-rc-conf gets installed to /usr/sbin/sysv-rc-conf and the man page goes to /usr/share/man/man8/sysv-rc-conf.8.gz. If that's fine with you, skip to step 3. If you want to change the installation paths, edit the first two lines of the Makefile. 3) Install it Once the Makefile is tailored to your liking, install the program. # make install sysv-rc-conf-0.99/README0000644000175000017500000000205510030072322014241 0ustar jfsjfs00000000000000sysv-rc-conf - Copyright 2004 Joe Oppegaard Why? I made this program because other "terminal gui" run-level configuration programs I used lacked features I wanted. I decided not to patch the others because I wanted something quite a bit different from the current offerings, though I used quite a few ideas from those programs. Plus it seemed like they were tied to the system they were being used on. (Like rcconf is a front-end to debian's update-rc.d). sysv-rc-conf's goal is to be a replacement for tools such as ntsysv (popular on RedHat systems) or rcconf (from Debian). sysv-rc-conf should be compatible with any system that uses SysV style rc*.d symlinks. I've really only tested it on Linux systems though, so any feedback would be appreciated. sysv-rc-conf is released under the GNU GPL. See COPYING for more information. Report bugs to Joe Oppegaard Web: http://sysv-rc-conf.sourceforge.net FTP: ftp://ftp.pidone.org/sysv-rc-conf Thanks to Thomas Hood for many suggestions and ideas. -Joe Oppegaard joe@pidone.org sysv-rc-conf-0.99/TODO0000644000175000017500000000270410112016134014052 0ustar jfsjfs00000000000000TODO for sysv-rc-conf: * "less" like search so you can type in a few letters of the service and the cursor jumps you to that row. Curses::UI supports this, just need to implement it the right way into the program * Colors, which Curses::UI also supports. I just haven't bothered trying to make the program look good with colors. * HALF DONE: Speed the program up. Initial thought it that each rl / service shouldn't have it's own ListBox object and should just use one for the whole row. I really want to do this horizontally though, so all rows for the current service will be bolded. Curses::UI doesn't support that at the moment, I plan to write a ptach to implement this. In the meantime the Listbox objects should get changed to Checkboxes, since that is really all they are, just a single checkbox. * DONE: A way to restore symlinks to what they were when the program started * Change from priority mode to normal mode on the fly * Re-order columns on the fly * Re-order rows on the fly * Check for unconfigured entries (no-symlink is not allowed) * Expand service name on demand to full name (toggle by v) * In priority mode: enable PageUp/PageDown. K and S should start overwrite. * Enable non-control normal character as alias for each command (vi/emacs) * DONE: --version or something to say what version of the program you're currently using. * Update xinetd.d/* files * Press F1 or something to actually view the script sysv-rc-conf-0.99/sysv-rc-conf.pl0000755000175000017500000010605010240443666016272 0ustar jfsjfs00000000000000#!/usr/bin/perl -w # This program is distributed under the terms of the GNU General Public License # # This file is part of sysv-rc-conf. # # sysv-rc-conf is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # sysv-rc-conf is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with sysv-rc-conf; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Copyright 2004 Joe Oppegaard # use strict; use Getopt::Long qw(:config no_ignore_case); use Curses; use Curses::UI; use constant { BOTTOM_LAB_HEIGHT => 2, BOTTOM_WIN_HEIGHT => 4, DEFAULT_K_PRI => 80, DEFAULT_S_PRI => 20, LABEL_WIDTH => 10, LIST_SN_LENGTH => 12, LIST_SN_PAD => 1, MAX_ROWS => 8, TOP_LABEL_HEIGHT => 2, }; my $VERSION = "0.99"; my %opts = ( cache_dir => "/var/lib/sysv-rc-conf", order => 'a', priority => '', purge_cache => 0, root => '/', show => '', verbose => '', chkcfg_levels => '2345', # default runlevels to affect if not specified chkcfg_list => undef, chkcfg_sn => '', chkcfg_state => '', ); GetOptions("cache=s" => \$opts{cache_dir}, "level=s" => \$opts{chkcfg_levels}, "list:s" => \$opts{chkcfg_list}, "order=s" => \$opts{order}, "priority" => \$opts{priority}, "Purge" => \$opts{purge_cache}, "root=s" => \$opts{root}, "show=s" => \$opts{show}, "verbose=s" => \$opts{verbose}, "Version" => sub { print STDERR "$0 $VERSION\n"; exit; }, ); my $runlevel_cmd = '/sbin/runlevel'; $opts{verbose} ||= "/dev/null"; open VERBOSE, "> $opts{verbose}" or die "Can't open $opts{verbose} : $!"; my $etc_rc = $opts{root} . "/etc/rc"; my $initd = $opts{root} . "/etc/init.d"; my @rls = qw/ 1 2 3 4 5 7 8 9 0 6 S /; check_args(); setup_cache_env(); my @show_rls = split //, $opts{show}; # Page index my $current_screen = 0; # Page screens my @s = (); # All the runlevel information my %runlevels = runlevel_status(); list_output(%runlevels) if defined $opts{chkcfg_list}; chkconfig_emulation(); my $cui = new Curses::UI( -clear_on_exit => 0, -color_support => 1, -default_colors => 1, ) or die "Can't create base Curses::UI object"; create_bottom_box(); # Get the service names for each screen my @snames_per_screen = split_services(); create_main_window(); my %box_pos = (x => '00', y => '00'); $cui->set_binding( \&toggle_help, "h" ); $cui->set_binding( \&revert_changes, "r") ; $cui->set_binding( sub { exit }, "q" ); $cui->set_binding( \&next_page, "\cN" ); $cui->set_binding( \&prev_page, "\cP" ); $s[$current_screen]->focus(); $cui->mainloop(); #--- rc access and modification subs ---# sub update_link { my ($sn, $rl, $sk, $pri) = @_; if (defined $sn && defined $rl && defined $sk && defined $pri) { if (-e "$etc_rc$rl.d/$sk$pri$sn") { # The symlink we are trying to make already exists return 'exists'; } } opendir (RL, "$etc_rc$rl.d") or die "$0: opendir $etc_rc$rl.d : $!"; foreach (grep { /[SK]\d\d$sn/i } readdir(RL)) { verbose("rm $etc_rc$rl.d/$_"); unlink "$etc_rc$rl.d/$_" or die "Can't unlink $etc_rc$rl.d/$_ : $!"; } # If in priority mode and are completely deleting the link, $sk will # be empty. return 1 if $sk eq ''; $pri = get_pri_cache($sn, $rl, $sk) unless $pri; unless ($pri =~ /^\d\d$/) { die "Priority isn't two numbers: $pri" } unless ($sk =~ /^[SK]$/) { die "You have to use S or K to start a link" } verbose("symlink $initd/$sn $etc_rc$rl.d/$sk$pri$sn"); # unlike ln relative symlinks are relative to the target file, not the cwd symlink "../init.d/$sn", "$etc_rc$rl.d/$sk$pri$sn" or die "Can't symlink $etc_rc$rl.d/$sk$pri$sn to ../init.d/$sn : $!\n"; } sub usage { print STDERR <] USAGE } sub chkconfig_emulation { $opts{chkcfg_sn} = $ARGV[0] if defined $ARGV[0]; $opts{chkcfg_state} = $ARGV[1] if defined $ARGV[1]; if ($opts{chkcfg_sn} && not $opts{chkcfg_state}) { # Check to see if service is configured to run in current rl # exit true if it is, false if not. # See chkconfig(8) my $current_rl = current_runlevel(); if (exists $runlevels{$opts{chkcfg_sn}}{$current_rl}) { if ($runlevels{$opts{chkcfg_sn}}{$current_rl} =~ /^S/) { # Service is configured to start, exit true exit 0; } } exit 1; } if ($opts{chkcfg_sn} && $opts{chkcfg_state}) { my $sk = ''; if ($opts{chkcfg_state} =~ /^on$/i) { $sk = 'S'; } elsif ($opts{chkcfg_state} =~ /^off$/i) { $sk = 'K'; } else { usage(); } foreach (split //, $opts{chkcfg_levels}) { update_link($opts{chkcfg_sn}, $_, $sk, undef); } exit 0; } # Program isn't being called like chkconfig, so return to normal # operation. return 1; } sub list_output { my (%runlevels) = @_; # There was an argument to --list my $opt_sn = $opts{chkcfg_list}; foreach my $sn (sort keys %runlevels) { my $output = substr $sn, 0, LIST_SN_LENGTH; $output .= " " until length $output >= LIST_SN_LENGTH + LIST_SN_PAD; foreach my $rl (sort keys %{$runlevels{$sn}}) { $output .= "$rl:"; if ($runlevels{$sn}{$rl} =~ /^[Ss]/) { $output .= "on"; } else { $output .= "off"; } $output .= "\t"; } chop($output); $output .= "\n"; if ($opt_sn) { print $output if $sn eq $opt_sn; } else { print $output; } } exit 0; } sub revert_changes { # Lookup table my %cache = (); foreach my $scr (@s) { for (my $i = 0; $i < max_services() ; $i++) { for (my $j = 0; $j <= $#show_rls; $j++) { my $obj = $scr->getobj(zero_pad($i).zero_pad($j)); my $ud = $obj->userdata(); $cache{ $ud->{sn} }{ $ud->{runlevel} } = $obj; } } } foreach my $sn (keys %runlevels) { foreach my $rl (keys %{$runlevels{$sn}}) { $runlevels{$sn}{$rl} =~ /^([SK])(\d\d)$/; my ($sk, $pri) = ($1, $2); next if update_link($sn, $rl, $sk, $pri) eq 'exists'; if (exists($cache{$sn}{$rl})) { my $box = $cache{$sn}{$rl}; if ($opts{priority}) { # Reset the text $box->text($sk.$pri); $box->draw(1); } else { # Simple layout, just toggle the box. $box->toggle(); $box->draw(1); } } } } $cui->dialog("Symlinks restored to original state!"); } sub start_service { my ($widget) = @_; my $ud = $widget->userdata(); st_service($ud->{sn}, 'start'); } sub stop_service { my ($widget) = @_; my $ud = $widget->userdata(); st_service($ud->{sn}, 'stop'); } sub st_service { my ($sn, $st) = @_; my $output = `$initd/$sn $st`; verbose("$initd/$sn $st : $output"); $cui->dialog("Results of $initd/$sn $st :\n" . $output); } sub get_pri_cache { my ($sn, $rl, $sk) = @_; # See if we can get an exact match from the cache, if not try to match # the S or K except in a different run level, if there still is not a match # get the opposite of S or K on another runlevel, if still no match return # the default. open CACHE, "< $opts{cache_dir}/services" or die "Can't open $opts{cache_dir}/services : $!"; chomp (my @cache = ); close CACHE; # Try an exact cache match foreach (@cache) { # $arg_rl $arg_sk $arg_pri $arg_sn next unless /^$rl\s+$sk\s+(\d\d)\s+$sn$/; verbose("Got exact cache match for priority: $_"); return $1; } # Try an $sk match, except on any runlevel foreach (@cache) { next unless /^[\dsS]\s+$sk\s+(\d\d)\s+$sn$/; verbose("Got differing runlevel cache for priority: $_"); return $1; } # Ok, try to match on any runlevel with either S or K foreach (@cache) { next unless /^[\dsS]\s+([SK])\s+(\d\d)\s+$sn$/; verbose("Returning difference of 100 and $2: $_"); # Sequence numbers are usually defined as stop = 100 - start # So that means that start = 100 - stop # Above we would have returned if $sk eq $1 so we know that $1 is # the opposite of $sk. So return 100 - $2. return zero_pad(100 - $2); } verbose("No cache found, returning default"); return DEFAULT_S_PRI if $sk eq 'S'; return DEFAULT_K_PRI if $sk eq 'K'; } sub pri_box_changed { my ($widget) = @_; my $ud = $widget->userdata(); my $new_link = $widget->get(); if ($new_link eq $ud->{last_good_text}) { # Text didn't actually change, just moved out of the box return 1; } if ($new_link =~ /^([KS])(\d\d)$/ or $new_link =~ /^$/) { my ($sk, $pri) = ('', ''); if (defined $1 and defined $2) { $sk = $1; $pri = $2; } update_link($ud->{sn}, $ud->{runlevel}, $sk, $pri); $ud->{last_good_text} = $new_link; } else { $cui->error("Incorrect format: $new_link\n" . "The correct format is a K or S followed by two digits!\n" . "Returning field back to original state." ); # Set the text in the box back to whatever the last good text was. $widget->{-text} = $ud->{last_good_text}; } } sub simple_box_changed { my ($box) = @_; my $userdata = $box->userdata(); $userdata->{changed}++; if ($box->get()) { update_link($userdata->{sn}, $userdata->{runlevel}, 'S', undef); } else { if ($userdata->{initial_state} == 1) { update_link($userdata->{sn}, $userdata->{runlevel}, 'K', undef); } else { update_link($userdata->{sn}, $userdata->{runlevel}, '', undef); } } } sub runlevel_status { my %runlevels = (); opendir (INITD, $initd) or die "$0: opendir $initd : $!"; while ( defined(my $service = readdir INITD) ) { next if $service =~ /\.sh$/; # see the debian policy manual next if $service =~ /\.dpkg-/; # see the debian policy manual next if $service =~ /^\.+$/; # ignore . and .. next if $service =~ /^rc$/; # ignore rc next if $service =~ /^rcS$/; # ignore rcS next if $service =~ /^skeleton$/; # ignore the sample init.d file next unless -f "$initd/$service"; # ignore non-files next unless -x "$initd/$service"; # ignore stuff like README $runlevels{$service} = { }; } closedir INITD or die "$0: closedir $initd : $!"; # While 7-9 usually aren't used, init supports it. foreach my $rl (@rls) { unless (opendir(DIR, "$etc_rc$rl.d")) { next if $rl =~ /^[789S]$/; die "$0: opendir $etc_rc$rl.d : $!"; } while ( defined(my $file = readdir DIR) ) { $file = "$etc_rc$rl.d/$file"; # Add the pathname to the file next unless -l $file; next if $file =~ /\.sh$/; next unless $file =~ /([SK])(\d\d)(.+)$/; my ($sk, $pri, $sn) = ($1, $2, $3); $runlevels{$sn}{$rl} = $sk.$pri; } closedir DIR or die "$0: closedir $etc_rc$rl.d : $!"; } update_cache(\%runlevels) if ! defined $opts{chkcfg_list}; return %runlevels; } sub setup_cache_env { unless (-e $opts{cache_dir}) { verbose("Creating non-existant cache directory: $opts{cache_dir}"); mkdir $opts{cache_dir} or die "Can't create $opts{cache_dir} : $!"; } if ($opts{purge_cache}) { verbose("Purging the services cache"); if (-e "$opts{cache_dir}/services") { unlink "$opts{cache_dir}/services" or die "Can't unlink $opts{cache_dir}/services : $!"; } } unless (-e "$opts{cache_dir}/services") { # Later we need to open the file with +< which can't create a new file # so we'll emulate touch. verbose("Touching $opts{cache_dir}/services"); open CACHE, "> $opts{cache_dir}/services" or die "Can't touch $opts{cache_dir}/services : $!"; close CACHE; } } sub update_cache { my ($runlevels) = @_; open CACHE, "+< $opts{cache_dir}/services" or die "Can't open $opts{cache_dir}/services for rw access : $!"; # Check to see if this service & rl already exists somewhere in this file # and update the line if so. my %touched = (); while () { chomp; next unless /^([\dSs])\s+([SK])\s+(\d\d)\s+([^\s]+)$/; my ($rl, $sk, $pri, $sn) = ($1, $2, $3, $4); if (exists $runlevels->{$sn}{$rl}) { $runlevels->{$sn}{$rl} =~ /^([SK])(\d\d)$/; $touched{$sn}{$rl} = 1; my ($n_sk, $n_pri) = ($1, $2); next if $sk eq $n_sk && $pri eq $n_pri; s/^.+$/$rl $n_sk $n_pri $sn/; } } foreach my $sn (sort keys %{$runlevels}) { foreach my $rl (sort keys %{$runlevels->{$sn}}) { unless (exists $touched{$sn}{$rl}) { $runlevels->{$sn}{$rl} =~ /^([SK])(\d\d)$/; print CACHE "$rl $1 $2 $sn\n"; } } } close CACHE or die "Can't close $opts{cache_dir}/services : $!"; } #--- Misc subs ---# sub check_args { $opts{show} ||= get_default_show(); unless ($opts{show} =~ /^[S0-9]*$/) { die "$0: --show must match [S0-9]\n"; } if (length($opts{show}) > MAX_ROWS) { die "$0: can only show ". MAX_ROWS . "rows at a time\n"; } return 1; } sub current_runlevel { if (-e $runlevel_cmd) { my $rl_out = `$runlevel_cmd`; $rl_out = 1 if $rl_out =~ /unknown/; $rl_out =~ /^\S\s?([Ss\d])?$/ or die "Unknown return from $runlevel_cmd : $rl_out"; return $1; } else { return 1; } } sub split_services { # Figure out how many services can fit on the screen, then make # as many screens as needed to fit all the services. my @screens = (); my @services = (); my %o_opts = (); $o_opts{p} = 1 if $opts{order} =~ /p/; $o_opts{n} = 1 if $opts{order} =~ /n/; $o_opts{a} = 1 unless exists $o_opts{p}; if ($opts{order} =~ /([Ss\d])/) { $o_opts{rl} = $1; } else { # If the --order option didn't set a runlevel to sort by, then # use the current runlevel (from the output of /sbin/runlevel) or # sort by runlevel 1 if the runlevel command doesn't exsist on this # system. $o_opts{rl} = current_runlevel(); } # Process the opts we just set. if (exists $o_opts{a}) { if (exists $o_opts{n}) { # Include the priority num on an alpha sort foreach my $sn (sort keys %runlevels) { next unless exists $runlevels{$sn}{$o_opts{rl}}; next unless $runlevels{$sn}{$o_opts{rl}} =~ /^[SK](\d\d)$/; push @services, $1.$sn; } } else { # Standard alpha sort @services = sort keys %runlevels; } } elsif (exists $o_opts{p}) { # Sort by priority at runlevel specified or current runlevel my @tmp_order = ( [ ], [ ] ); # S is 0 and K is 1 foreach my $sn (keys %runlevels) { next unless exists $runlevels{$sn}{$o_opts{rl}}; next unless $runlevels{$sn}{$o_opts{rl}} =~ /^([SK])(\d\d)$/; if ($1 eq 'S') { push @{$tmp_order[0]}, $2.$sn } elsif ($1 eq 'K') { push @{$tmp_order[1]}, $2.$sn } } foreach (0, 1) { foreach my $ddsn (sort @{$tmp_order[$_]}) { $ddsn =~ /^(\d\d)(.+)$/; if (exists $o_opts{n}) { # Include the priority num on a pri sort push @services, $1.$2; } else { push @services, $2; } } } } { # We could be missing some services if they didn't have a link in the # runlevel we were sorting by. This happens in all circumstances except # the default of just 'a' being set. my %seen = (); foreach (@services) { next unless $_ =~ /^(\d\d)?(.+)$/; $seen{$2} = 1; } foreach (sort keys %runlevels) { unless (exists $seen{$_}) { push(@services, $_); } } } my $per_screen = max_services(); my $i = 0; do { $screens[$i] = [ splice(@services, 0, $per_screen) ]; $i++; } while @services; return @screens; } sub max_services { my $tmp_screen = $cui->add( undef, 'Window', -title => "N/A", -border => 1, -padtop => 1, -padbottom => 4, -ipad => 1, ); my $ms = $tmp_screen->canvasheight() - TOP_LABEL_HEIGHT; undef $tmp_screen; # Make sure the memory is cleaned up. return $ms; } sub get_default_show { my $show = ''; foreach (@rls) { if (-e "$etc_rc$_.d") { $show .= $_; } } return $show; } sub zero_pad { sprintf('%.2u', $_[0]); } sub verbose { print VERBOSE $_[0]."\n" if $opts{verbose}; } #--- Screen layout subs ---# sub create_main_window { create_help_window(); my $i = 0; foreach my $services (@snames_per_screen) { # First create the main window all of this page of services goes in my $id = "window_$i"; my $screen = $cui->add( $id, 'Window', -title => "SysV Runlevel Config -: stop service =/+: start service h: help q: quit", -border => 1, -padtop => 1, -padbottom => 4, -ipad => 1, ); # Can't set these globally (on $cui) or else it overrides the # keybindings on all other objects $screen->set_binding( \&move_up, KEY_UP(), ); $screen->set_binding( \&move_down, KEY_DOWN(), ); $screen->set_binding( \&move_left, KEY_LEFT(), ); $screen->set_binding( \&move_right, KEY_RIGHT(), ); create_top_label($screen); my $left_label = ''; for (my $i = 0; $i < scalar(@$services); $i++) { $left_label .= $services->[$i] . "\n"; if ($services->[$i] =~ /^\d\d(.+)$/) { # If the labels had numbers, we don't need them anymore. $services->[$i] = $1; } } my $row = TOP_LABEL_HEIGHT; $screen->add( undef, 'Label', -text => $left_label, -y => $row, -width => LABEL_WIDTH, -height => last_x() + 1, ); foreach my $sn (@$services) { if ($opts{priority}) { draw_priority_layout($screen, $sn, $row) } else { draw_simple_layout($screen, $sn, $row) } $row++; } $s[$i] = $screen; $i++; } } sub create_help_window { my $help_text = < EOF my $hw = $cui->add( 'help_window', 'Window', -title => "SysV Runlevel Config -: stop service =/+: start service h: help q: quit", -border => 1, -padtop => 1, -padbottom => 4, -ipad => 1, -userdata => 0, ); $hw->add( 'help_tv', 'TextViewer', -text => $help_text, -title => 'sysv-rc-conf help', -vscrollbar => 1, ); } sub draw_simple_layout { my ($screen, $sn, $row) = @_; for (my $i = 0, my $right_n = 12; $i <= $#show_rls; $i++, $right_n += 8) { my $on_or_off = 0; my $initial_state = 0; # We only want to show S\d\d services as selected. if (exists $runlevels{$sn}{$show_rls[$i]}) { if ($runlevels{$sn}{$show_rls[$i]} =~ /^S\d\d$/) { $on_or_off = 1; } $initial_state = 1; } my $box = $screen->add( zero_pad($row-2).zero_pad($i), 'Checkbox', -label => '', -checked => $on_or_off, -border => 0, -x => $right_n, -y => $row, -width => 5, #-height => 1, -userdata => { id => zero_pad($row-2).zero_pad($i), sn => $sn, changed => 0, runlevel => $show_rls[$i], initial_state => $initial_state, }, -onchange => \&simple_box_changed, -onfocus => \&got_focus, ); $box->set_binding( \&start_service, "=", "+" ); $box->set_binding( \&stop_service, "-" ); } } sub draw_priority_layout { my ($screen, $sn, $row) = @_; for (my $i = 0, my $right_n = 11; $i <= $#show_rls; $i++, $right_n += 8) { my $text = exists $runlevels{$sn}{$show_rls[$i]} ? $runlevels{$sn}{$show_rls[$i]} : ''; my $box = $screen->add( zero_pad($row-2).zero_pad($i), 'TextEntry', -sbborder => 1, -x => $right_n, -y => $row, -width => 6, -maxlength => 3, -regexp => '/^[skSK\d]*$/', -toupper => 1, -showoverflow => 0, -text => $text, -userdata => { id => zero_pad($row-2).zero_pad($i), sn => $sn, changed => 0, runlevel => $show_rls[$i], last_good_text => $text, }, -onblur => \&pri_box_changed, -onfocus => \&got_focus, ); $box->set_binding( \&start_service, "=", "+" ); $box->set_binding( \&stop_service, "-" ); } } sub create_top_label { my ($window) = @_; my @label_rls = @show_rls; my $text = 'service ' . shift @label_rls; foreach (@label_rls) { $text .= " $_" }; $text .= "\n"; $text .= "-" x 76; $window->add( undef, 'Label', -text => $text, -y => 0, -x => 0, -height => TOP_LABEL_HEIGHT, -textalignment => 'left', ); } sub create_bottom_box { my $cmd_text = ''; if ($opts{priority}) { $cmd_text = "Editing: Backspace: bs ^d: delete ^b: backward ^f: forward"; } else { $cmd_text = " space: toggle service on / off ", } my $exp_window = $cui->add( 'exp_window', 'Window', -border => 1, -y => -1, -height => BOTTOM_WIN_HEIGHT, -ipadleft => 1, -ipadright => 1, ); $exp_window->add(undef, 'Label', -y => 0, -width => -1, -height => BOTTOM_LAB_HEIGHT, -text => "Use the arrow keys or mouse to move around. ^n: next pg ^p: prev pg\n$cmd_text", ); } sub toggle_help { my $hw = $cui->getobj('help_window'); my $hw_data = $hw->userdata(); if ($hw_data == 0) { $hw->userdata($cui->getfocusobj); $hw->focus(); } else { # The help window is up, so turn it off by focusing the last # object that was focused on before we pulled up the help window $hw_data->focus(); $hw->userdata(0); } } #--- Movement subs ---# sub next_page { $current_screen++; $current_screen = 0 if $current_screen > last_screen(); verbose("Going to screen $current_screen"); _move_focus(00, $box_pos{y}); } sub prev_page { $current_screen--; $current_screen = last_screen() if $current_screen < 0; verbose("Going to screen $current_screen"); $box_pos{x} = last_x(); _move_focus($box_pos{x}, $box_pos{y}); } sub got_focus { my $widget = shift; # Is there a better way to figure out my own id besides putting it # in userdata on creation and fetching it? my $userdata = $widget->userdata(); my $id = $userdata->{id}; $id =~ /^(\d\d)(\d\d)$/; $box_pos{x} = $1; $box_pos{y} = $2; } sub move_left { return if $box_pos{y} eq '00'; _move_focus($box_pos{x}, $box_pos{y} - 1); } sub move_right { return if $box_pos{y} == scalar(@show_rls)-1; _move_focus($box_pos{x}, $box_pos{y} + 1); } sub move_up { #return if $box_pos{x} eq '00'; return prev_page() if $box_pos{x} eq '00'; _move_focus($box_pos{x} - 1, $box_pos{y}); } sub move_down { # Index starts at 00, so we need one less then the max services that # are on the screen. return next_page() if $box_pos{x} == last_x(); _move_focus($box_pos{x} + 1, $box_pos{y}); } sub _move_focus { $box_pos{x} = $_[0]; $box_pos{y} = $_[1]; my $box = $s[$current_screen]->getobj(zero_pad($_[0]).zero_pad($_[1])); $box->focus(); } sub last_x { return scalar(@{$snames_per_screen[$current_screen]})-1; } sub first_screen { return 0 } sub last_screen { return scalar(@s)-1 } =pod =head1 NAME B - Run-level configuration for SysV like init script links =head1 SYNOPSIS B [ I ] B --list [ I ] B [ --level I ] I EIE =head1 DESCRIPTION B gives an easy to use interface for managing C symlinks. The interface comes in two different flavors, one that simply allows turning services on or off and another that allows for more fine tuned management of the symlinks. It's a replacement for programs like B or B. B can also be used at the command line when the desired changes to the symlinks are already known. The syntax is borrowed from B, although it does not follow it exactly. =head1 GENERAL OPTIONS =over =item B<-c> DIRECTORY, B<--cache=>DIRECTORY The directory where the priority numbers, old runlevel configuration, etc. should be stored. This defaults to C. See the FILES section below and the --Purge option. =item B<-r> DIRECTORY, B<--root=>DIRECTORY The root directory to use. This defaults to C. This comes in handy if the root file system is mounted somewhere else, such as when using a rescue disk. =item B<-P>, B<--Purge> Purge the information stored in the cache file. See the FILES section below and the --cache option. =item B<-v> FILE, B<--verbose=>FILE Print verbose information to C =item B<-V>, B<--Version> Print version information to STDOUT and exit =back =head1 GUI RELATED OPTIONS =over =item B<-o> [ see description ], B<--order=>[ see description ] Allows various sorting orders and ways to display the rows. The argument can be made up of any of the following: =over =item B Sort the rows Blphabetically. This is the default if the B<-o> option isn't specified. =item B Show the priority numbers along with the name of the service. =item B

Sorts by the B

riority numbers. =item B I can be any runlevel, 0-9 or S. This controls which runlevel the priority numbers are sorted at. It only makes sense to use this in conjuntion with B

. If omitted the priority numbers are sorted by the current runlevel the system is in. =back =item B<-p>, B<--priority> Alternate layout. Instead of just showing a checkbox, the priority of the service and the S or K are allowed to be edited. This is for more fine tuned control then the default layout allows. =item B<-s> I, B<--show=>I Which runlevels to show. This defaults to up to 8 of the runlevels available on the system. Usually this means it will show 1, 2, 3, 4, 5, 0, 6, and S. The syntax calls for the runlevels to be allruntogether. For instance, to show runlevels 3, 4, and 5 the syntax would be C<--show=345>. Also see B<--order>. =back =head1 CLI RELATED OPTIONS =over =item B<--level> I The runlevels this operation will affect. I can be any number from 0-9 or S. For example, B<--level 135> will affect runlevels 1, 3, and 5. If B<--level> is not set, the default is to affect runlevels 2, 3, 4, and 5. This option is only used for the command line interface, see the section below labled USING THE CLI for more information. =item B<--list> [I] This option will list all of the services and if they are stopped or started when entering each runlevel. If I is specified, only the information for that service is displayed. =back =head1 USING THE GUI =head2 Note When using either GUI layout described below, all configuration changes to the symlinks will happen immediately, not when the program exits. =head2 Using the Default layout The default (simple) layout shows in a grid fashion all of the services that are in C and which runlevels they are turned on at. For example, where the C row and C<3> column intersect, if there is an 'X' in the box there that means the ssh service will be turned on when entering runlevel 3. If there is no checkbox it can mean that either there are no links to the service in that specific runlevel, or that the service is turned off when entering that runlevel. If more configuration detail is needed, see the next paragraph and the B<--priority> option. =head2 Using the Priority layout The priority (advanced) layout also uses a grid fashion, but instead of checkboxes there are text boxes that can have a few different values. If the text box is blank, that means there isn't a symlink in that runlevel for that service. This means that when changing into that runlevel that the service will not be started or stopped, which is significant. If the text box starts with the letter K that means that the service will be stopped when entering that runlevel. If the text box starts with the letter S that means the service will be started when entering that runlevel. The two digits following is the order in which the services are started. That means that C would start before C. For more information see your system documentation. =head2 Controls To move around use the arrow keys, or if the terminal support it, the mouse. Typically there is more then one page of services (unless the terminal screen is large), to move between the pages use CTRL-n or CTRL-p, or simply arrow key down or up at the bottom or top of the screen, respectively. The bottom of the screen also shows these movement commands for quick reference. To restore the symlinks back to their original state before the B was run, press the B key. The B key will display a quick reference help screen. =head2 Default layout When using the default layout use the space bar to toggle the service on / off. An 'X' in the checkbox indicates that the service is on. =head2 Priority layout The priority layout uses the default movement keys. In order to edit the fields you can use CTRL-d to delete the character in front of the cursor or backspace to backspace. Use CTRL-b or CTRL-f to move the cursor backwards or forwards within the field. Note that only S, K, or any digit is allowed to be entered into the field. =head2 Starting / Stopping Services To start a service now, press the C<+> or C<=> key. To stop a service now, press the C<-> key. This will call C or C. =head1 USING THE CLI If the desired modifications to the symlinks are known and only one quick change is needed, then you can use a CLI interface to B. Examples: # sysv-rc-conf --level 35 ssh off # sysv-rc-conf atd on The first example will turn ssh off on levels 3 and 5. The second example turns atd on for runlevels 2, 3, 4, and 5. =head1 FILES B Feel free to skip this section B stores a cache of all the symlink information from C in C (See the --cache option to change the location of this file). It uses this cache to make an intelligent decision on what priority number to give the K or S link when they are changed in the simple layout. This cache is updated/created everytime the program is launched. The program needs to run with root privileges in order to update the cache. The format of the file is as follows: RUNLEVEL S|K PRIORITY SERVICE Here's a few examples: 2 K 74 ntpd 2 K 50 xinetd 3 S 08 iptables 3 S 80 sendmail B will first see if it can get an exact match from the cache. For example, if the symlink for C in runlevel 3 is S89cron and you uncheck it, B will first see if there is an entry in the cache that looks like C<3 K nn cron>, if so it will use nn for the priority number. If there wasn't a match, B will then see if there is another S or K (whichever you're switching to, so in this example, K) entry on a different runlevel - so an entry like C, where i is any runlevel. If found, the link will use nn. If there still wasn't a match, B will look for the opposite of S or K in any run level, and use 100 - that priority. So in our example, C. If nn is 20, then it will use 80 (100 - 20), since that is typically the way that the priority numbers are used. If there still isn't a match, the default priority of 20 for S links is used, and the default priority of 80 for K links is used. =head1 COMPATIBILITY B should work on any Unix like system that manages services when changing runlevels by using symlinks in C. Refer to your system documentation to see if that's the case (usually there's a C). =head1 CAVEATS B only manages the symlinks in the C directories. It's possible that packages may have other ways of being disabled or enabled. Because Curses takes over the screen sometimes error messages won't be seen on the terminal. If you run across any weird problems try redirecting STDERR to a file when you execute the program. For example: # sysv-rc-conf 2E err.out =head1 REPORTING BUGS Report bugs to Joe Oppegaard Ejoe@pidone.orgE =head1 SEE ALSO B, B, B, C www: http://sysv-rc-conf.sourceforge.net ftp: ftp://ftp.pidone.org/sysv-rc-conf =head1 AUTHOR Joe Oppegaard Ejoe@pidone.orgE