[LON-CAPA-cvs] cvs: doc /loncapafiles chkconfig.piml modify_config_files.piml ntpcheck.piml picins_check.piml rpmcheck.piml wrap_setuid.piml

raeburn raeburn at source.lon-capa.org
Tue Oct 25 09:01:32 EDT 2011


raeburn		Tue Oct 25 13:01:32 2011 EDT

  Modified files:              
    /doc/loncapafiles	chkconfig.piml modify_config_files.piml 
                     	ntpcheck.piml picins_check.piml rpmcheck.piml 
                     	wrap_setuid.piml 
  Log:
  - Support Fedora 16 (/bin/systemctl replacing chkconfig and Sys V init.d.
  - Better handling of ntp checking for both Fedora 15 and 16 in ntpcheck.piml.   
  
  
-------------- next part --------------
Index: doc/loncapafiles/chkconfig.piml
diff -u doc/loncapafiles/chkconfig.piml:1.17 doc/loncapafiles/chkconfig.piml:1.18
--- doc/loncapafiles/chkconfig.piml:1.17	Fri May 13 03:23:53 2011
+++ doc/loncapafiles/chkconfig.piml	Tue Oct 25 13:01:32 2011
@@ -3,7 +3,7 @@
 <!-- checkconfig.piml -->
 <!-- Matthew Hall -->
 
-<!-- $Id: chkconfig.piml,v 1.17 2011/05/13 03:23:53 raeburn Exp $ -->
+<!-- $Id: chkconfig.piml,v 1.18 2011/10/25 13:01:32 raeburn Exp $ -->
 
 <!--
 
@@ -36,9 +36,11 @@
 <target dist="default"></target>
 <perlscript mode="fg">
 my $checker_bin = '/sbin/chkconfig';
+my $systemctl_bin = '/bin/systemctl';
 my $webserver ='httpd';
 my @runlevels = qw/3 4 5/;
 my @norunlevels = qw/0 1 6/;
+my $use_systemctl;
 
 if ('<DIST />' eq 'suse9.3' || '<DIST />' eq 'suse9.2' || '<DIST />' eq 'sles9') {
     $webserver = 'apache';
@@ -51,40 +53,53 @@
     @norunlevels = qw/0 1 6/;
     $checker_bin = '/usr/sbin/sysv-rc-conf';
     $webserver = 'apache2';
+} elsif ('<DIST />' eq 'fedora16') {
+    $use_systemctl = 1;
 }
 exit if (! -x $checker_bin);
 
 my $rlstr = join('', at runlevels);
 my $nrlstr = join('', at norunlevels);
 foreach my $service ($webserver,'loncontrol') {
-    my $command = $checker_bin.' --list '.$service;
-    my $results = `$command`;
-    if ($results eq '') {
-        print "**** WARNING: $service is not set to run on boot.$/".
-        "    Execute the following commands to fix this:".$/;
-        if ('<DIST />' eq 'debian5' || '<DIST />' eq 'debian6' || '<DIST />' eq 'ubuntu6' ||  '<DIST />' eq 'ubuntu8' || '<DIST />' eq 'ubuntu10') {
-            print "        $checker_bin --level $nrlstr $service off".$/;
-        } else {
-             print "        $checker_bin --add $webserver".$/;
+    if (($use_systemctl) && ($service eq 'httpd')) { 
+        my $command = "systemctl is-enabled httpd.service";
+        my $results = `$command`;
+        chomp($results);
+        if ($results ne 'enabled') {
+            print "**** WARNING: $service is not set to run on boot.".$/.
+                  "    Execute the following commands to fix this:".$/.
+                  "    systemctl enable httpd.service".$/;
         }
-        print "        $checker_bin --level $rlstr $service on".$/;
     } else {
-        my %curr_runlevels;
-        for (my $rl = 0;$rl <=6;$rl++) {
-           if ($results =~ /$rl:on/) { $curr_runlevels{$rl}++; }
-        }
-        #
-        my $warning;
-        foreach my $rl (@runlevels) {
-            if (! exists($curr_runlevels{$rl}) ) {
-                $warning .=
-                   "**** WARNING: $service is not set to run at runlevel $rl".$/;
+        my $command = $checker_bin.' --list '.$service;
+        my $results = `$command`;
+        if ($results eq '') {
+            print "**** WARNING: $service is not set to run on boot.$/".
+            "    Execute the following commands to fix this:".$/;
+            if ('<DIST />' eq 'debian5' || '<DIST />' eq 'debian6' || '<DIST />' eq 'ubuntu6' ||  '<DIST />' eq 'ubuntu8' || '<DIST />' eq 'ubuntu10') {
+                print "        $checker_bin --level $nrlstr $service off".$/;
+            } else {
+                print "        $checker_bin --add $webserver".$/;
+            }
+            print "        $checker_bin --level $rlstr $service on".$/;
+        } else {
+            my %curr_runlevels;
+            for (my $rl = 0;$rl <=6;$rl++) {
+                if ($results =~ /$rl:on/) { $curr_runlevels{$rl}++; }
+            }
+            #
+            my $warning;
+            foreach my $rl (@runlevels) {
+                if (! exists($curr_runlevels{$rl}) ) {
+                    $warning .=
+                       "**** WARNING: $service is not set to run at runlevel $rl".$/;
+                }
+            }
+            if ($warning) {
+                print $warning.
+                      "    Execute the following command to fix this:".$/.
+                      "        $checker_bin --level $rlstr $service on".$/;
             }
-        }
-        if ($warning) {
-            print $warning.
-                  "    Execute the following command to fix this:".$/.
-                  "        $checker_bin --level $rlstr $service on".$/;
         }
     }
 }
Index: doc/loncapafiles/modify_config_files.piml
diff -u doc/loncapafiles/modify_config_files.piml:1.14 doc/loncapafiles/modify_config_files.piml:1.15
--- doc/loncapafiles/modify_config_files.piml:1.14	Sun Feb 27 18:54:59 2011
+++ doc/loncapafiles/modify_config_files.piml	Tue Oct 25 13:01:32 2011
@@ -3,7 +3,7 @@
 <!-- modify_config_files.piml -->
 <!-- Matthew Hall -->
 
-<!-- $Id: modify_config_files.piml,v 1.14 2011/02/27 18:54:59 raeburn Exp $ -->
+<!-- $Id: modify_config_files.piml,v 1.15 2011/10/25 13:01:32 raeburn Exp $ -->
 
 <!--
 
@@ -35,24 +35,27 @@
 <file>
 <target dist="default">/</target>
 <perlscript mode="fg">
-my $mysqldaemon = 'mysqld';
 my $configfiles = 'yum and MySQL';
+my $mysqlcmd = '/etc/init.d/mysqld restart';
 if ('<DIST />' eq 'suse9.2' || '<DIST />' eq 'suse9.3' || '<DIST />' eq 'sles9' || '<DIST />' eq 'sles10' || '<DIST />' eq 'sles11' || '<DIST />' eq 'suse10.1' || '<DIST />' eq 'suse10.2' || '<DIST />' eq 'suse10.3' || '<DIST />' eq 'suse11.1' || '<DIST />' eq 'suse11.2' || '<DIST />' eq 'suse11.3' || '<DIST />' eq 'suse11.4') {
-    $mysqldaemon = 'mysql';
+    $mysqlcmd = '/etc/init.d/mysql restart';
     $configfiles = 'MySQL';
 } elsif ('<DIST />' eq 'rhes4') {
     $configfiles = 'MySQL';
 } elsif ('<DIST />' eq 'debian5' || '<DIST />' eq 'debian6' || '<DIST />' eq 'ubuntu6' || '<DIST />' eq 'ubuntu8' || '<DIST />' eq 'ubuntu10') {
     $configfiles = 'Apt and MySQL';
-    $mysqldaemon = 'mysql';
+    $mysqlcmd = '/etc/init.d/mysql restart';
+} elsif ('<DIST />' eq 'fedora16') {
+    $mysqlcmd = '/bin/systemctl restart mysqld.service';  
 }
+
 print "\nUpdating $configfiles configuration files\n";
 system("/home/httpd/perl/modify_config_files.pl");
 my $returnvalue = $?>>8;
 if ($returnvalue == 1) {
     ## the /etc/my.cnf file was modified.
     print "**** WARNING: You need to restart MySQL at this time.\n".
-        "    Use the command \"/etc/init.d/$mysqldaemon restart\"\n";
+        "    Use the command \"$mysqlcmd\"\n";
 }
 </perlscript>
 </file>
Index: doc/loncapafiles/ntpcheck.piml
diff -u doc/loncapafiles/ntpcheck.piml:1.12 doc/loncapafiles/ntpcheck.piml:1.13
--- doc/loncapafiles/ntpcheck.piml:1.12	Tue May 31 11:27:24 2011
+++ doc/loncapafiles/ntpcheck.piml	Tue Oct 25 13:01:32 2011
@@ -3,7 +3,7 @@
 <!-- ntpcheck.piml -->
 <!-- Matthew Hall -->
 
-<!-- $Id: ntpcheck.piml,v 1.12 2011/05/31 11:27:24 raeburn Exp $ -->
+<!-- $Id: ntpcheck.piml,v 1.13 2011/10/25 13:01:32 raeburn Exp $ -->
 
 <!--
 
@@ -38,19 +38,45 @@
 print "Checking to be sure the Network Time Protocol is running properly.\n";
 print "For more information on ntpd please see http://www.ntp.org/\n";
 my $NTPD;
-if (-e "/etc/init.d/ntpd") {
-   $NTPD = "ntpd";
-} elsif (-e "/etc/init.d/xntpd") {
-   $NTPD = "xntpd";
-} elsif (-e "/etc/init.d/ntp") {
-   $NTPD = "ntp"; 
+if (('<DIST />' eq 'fedora15') || ('<DIST />' eq 'fedora16')) {
+    $NTPD = 'ntpd';
+    if (!-e '/usr/sbin/ntpd') {
+        print "ntp is not installed.\n";
+        exit;
+    } else {
+        if (open(PIPE,"systemctl status ntpd.service|")) {
+            my @lines = <PIPE>;
+            chomp(@lines);
+            my $is_running;
+            foreach my $line (@lines) {
+                if ($line =~ /Active: active/) {
+                    $is_running = 1;
+                    last; 
+                }
+            }
+            close(PIPE);
+            if (!$is_running) {
+                print "WARNING: ntp is installed but is not currently running.\nPlease verify the configuration of ntp in /etc/ntp.conf and /etc/ntp/step-tickers\nStart ntp by executing\n systemctl start ntpd.service|\n";
+            }
+        } else {
+            print "Could not determine ntp status.\n";
+        }
+    }
 } else {
-    print "ntp is not installed.\n";
-    exit;
-}
-my $value = `/etc/init.d/$NTPD status`;
-if ($value !~ /running/) {
-    print "WARNING: ntp is installed but is not currently running.\nPlease verify the configuration of ntp in /etc/ntp.conf and /etc/ntp/step-tickers\nStart ntp by executing\n /etc/init.d/$NTPD start\n";
+    if (-e "/etc/init.d/ntpd") {
+        $NTPD = "ntpd";
+    } elsif (-e "/etc/init.d/xntpd") {
+        $NTPD = "xntpd";
+    } elsif (-e "/etc/init.d/ntp") {
+        $NTPD = "ntp"; 
+    } else {
+        print "ntp is not installed.\n";
+        exit;
+    }
+    my $value = `/etc/init.d/$NTPD status`;
+    if ($value !~ /running/) {
+        print "WARNING: ntp is installed but is not currently running.\nPlease verify the configuration of ntp in /etc/ntp.conf and /etc/ntp/step-tickers\nStart ntp by executing\n /etc/init.d/$NTPD start\n";
+    }
 }
 # chkconfig barfs to stderr if the target isn't set up right.
 my $checking_bin;
@@ -60,7 +86,7 @@
 } else {
     $checking_bin = '/sbin/chkconfig';
 }
-if ('<DIST />' eq 'fedora15') {
+if (('<DIST />' eq 'fedora15') || ('<DIST />' eq 'fedora16')) {
     if (!-l "/etc/systemd/system/multi-user.target.wants/ntpd.service") {  
         print "**** WARNING: ntpd is not configured to run at boot.  To correct this run:\nsystemctl enable ntpd.service\n";
     }
Index: doc/loncapafiles/picins_check.piml
diff -u doc/loncapafiles/picins_check.piml:1.13 doc/loncapafiles/picins_check.piml:1.14
--- doc/loncapafiles/picins_check.piml:1.13	Sun May  8 00:39:20 2011
+++ doc/loncapafiles/picins_check.piml	Tue Oct 25 13:01:32 2011
@@ -3,7 +3,7 @@
 <!-- picins_check.piml -->
 <!-- Stuart Raeburn -->
 
-<!-- $Id: picins_check.piml,v 1.13 2011/05/08 00:39:20 raeburn Exp $ -->
+<!-- $Id: picins_check.piml,v 1.14 2011/10/25 13:01:32 raeburn Exp $ -->
 
 <!--
 
@@ -32,7 +32,7 @@
 <piml>
 <files>
 <file>
-<perlscript mode="fg" dist="fedora9 fedora10 fedora11 fedora12 fedora13 fedora14 fedora15 rhes6 scientific6 centos6 sles11 suse11.1 suse11.2 suse11.3 suse11.4 debian5 debian6 ubuntu8 ubuntu10">
+<perlscript mode="fg" dist="fedora9 fedora10 fedora11 fedora12 fedora13 fedora14 fedora15 fedora16 rhes6 scientific6 centos6 sles11 suse11.1 suse11.2 suse11.3 suse11.4 debian5 debian6 ubuntu8 ubuntu10">
     my $picinspath = '/usr/share/texmf/tex/latex/picins'; 
     my $file = 'picins.sty';
     if (!-e "$picinspath/$file") {
Index: doc/loncapafiles/rpmcheck.piml
diff -u doc/loncapafiles/rpmcheck.piml:1.24 doc/loncapafiles/rpmcheck.piml:1.25
--- doc/loncapafiles/rpmcheck.piml:1.24	Fri May 13 11:03:07 2011
+++ doc/loncapafiles/rpmcheck.piml	Tue Oct 25 13:01:32 2011
@@ -3,7 +3,7 @@
 <!-- phpcheck.piml -->
 <!-- Matthew Hall -->
 
-<!-- $Id: rpmcheck.piml,v 1.24 2011/05/13 11:03:07 raeburn Exp $ -->
+<!-- $Id: rpmcheck.piml,v 1.25 2011/10/25 13:01:32 raeburn Exp $ -->
 
 <!--
 
@@ -81,7 +81,7 @@
     }
 }
 </perlscript>
-<perlscript dist="fedora1 fedora2 fedora3 fedora4 fedora5 fedora6 fedora7 fedora8 fedora9 fedora10 fedora11 fedora12 fedora13 fedora14 fedora15 rhes5 rhes6 centos5 scientific5 scientific6 centos6 suse9.2 suse9.3 suse10.1 suse10.2 suse10.3 sles9 sles10 sles11 suse11.1 suse11.2 suse11.3 suse11.4" mode="fg">
+<perlscript dist="fedora1 fedora2 fedora3 fedora4 fedora5 fedora6 fedora7 fedora8 fedora9 fedora10 fedora11 fedora12 fedora13 fedora14 fedora15 fedora16 rhes5 rhes6 centos5 scientific5 scientific6 centos6 suse9.2 suse9.3 suse10.1 suse10.2 suse10.3 sles9 sles10 sles11 suse11.1 suse11.2 suse11.3 suse11.4" mode="fg">
 my $hasprereqs = 0;
 if (open(PIPE,"rpm -q LONCAPA-prerequisites|")) {
     my @lines = (<PIPE>);
Index: doc/loncapafiles/wrap_setuid.piml
diff -u doc/loncapafiles/wrap_setuid.piml:1.14 doc/loncapafiles/wrap_setuid.piml:1.15
--- doc/loncapafiles/wrap_setuid.piml:1.14	Sun May  8 00:47:47 2011
+++ doc/loncapafiles/wrap_setuid.piml	Tue Oct 25 13:01:32 2011
@@ -3,7 +3,7 @@
 <!-- wrap_setuid.piml -->
 <!-- Guy Albertelli -->
 
-<!-- $Id: wrap_setuid.piml,v 1.14 2011/05/08 00:47:47 raeburn Exp $ -->
+<!-- $Id: wrap_setuid.piml,v 1.15 2011/10/25 13:01:32 raeburn Exp $ -->
 
 <!--
 
@@ -37,7 +37,7 @@
 <perlscript mode="fg" dist="default">
 #print("Not wrapping setuid scripts\n");
 </perlscript>
-<perlscript mode="fg" dist="suse9.2 suse9.3 sles9 sles10 sles11 suse10.1 suse10.2 suse10.3 suse11.1 suse11.2 suse11.3 suse11.4 fedora14 fedora15">
+<perlscript mode="fg" dist="suse9.2 suse9.3 sles9 sles10 sles11 suse10.1 suse10.2 suse10.3 suse11.1 suse11.2 suse11.3 suse11.4 fedora14 fedora15 fedora16">
 
 $fslist='<TARGET />';
 open(FIND,  "find <TARGET /> -xdev -type f \\( -perm -04000 -o -perm -02000 \\) -print|");


More information about the LON-CAPA-cvs mailing list