[LON-CAPA-cvs] cvs: doc /install/linux install.pl

raeburn raeburn@source.lon-capa.org
Sat, 23 Apr 2011 23:35:19 -0000


raeburn		Sat Apr 23 23:35:19 2011 EDT

  Modified files:              
    /doc/install/linux	install.pl 
  Log:
  - Changes to accommodate SuSE/SLES
    - check /etc/sysconfig/language for locale
    - ntp daemon is ntp
    - cups daemon is cups
    - scope for scalar with apache dir. name (apache2 for SuSE/SLES, version 10 or later). 
  
  
Index: doc/install/linux/install.pl
diff -u doc/install/linux/install.pl:1.7 doc/install/linux/install.pl:1.8
--- doc/install/linux/install.pl:1.7	Sat Apr 23 19:04:42 2011
+++ doc/install/linux/install.pl	Sat Apr 23 23:35:19 2011
@@ -72,7 +72,7 @@
           &mt('Stopping execution.')."\n";
     exit;
 } else {
-    print LOG '$Id: install.pl,v 1.7 2011/04/23 19:04:42 raeburn Exp $'."\n";
+    print LOG '$Id: install.pl,v 1.8 2011/04/23 23:35:19 raeburn Exp $'."\n";
 }
 
 #
@@ -293,7 +293,7 @@
             } else {
                 my $line = <PIPE>;
                 chomp($line);
-                if ($line =~ /^LONCAPA-prerequisites\-([\d\-]+)\.(\w+)$/) {
+                if ($line =~ /^LONCAPA\-prerequisites\-([\d\-]+)\.(?:[.\w]+)$/) {
                     $gotprereqs = $1;
                 }
             }
@@ -307,12 +307,19 @@
 
 sub check_locale {
     my ($distro) = @_;
-    my ($fh,$command);
+    my ($fh,$langvar,$command);
+    $langvar = 'LANG';
     if ($distro =~ /^(ubuntu|debian)/) {
         if (!open($fh,"</etc/default/locale")) {
             print &mt('Failed to open: [_1], default locale not checked.',
                       '/etc/default/locale');
         }
+    } elsif ($distro =~ /^(suse|sles)/) {
+        if (!open($fh,"</etc/sysconfig/language")) {
+            print &mt('Failed to open: [_1], default locale not checked.',
+                      '/etc/sysconfig/language');
+        }
+        $langvar = 'RC_LANG';
     } else {
         if (!open($fh,"</etc/sysconfig/i18n")) {
             print &mt('Failed to open: [_1], default locale not checked.',
@@ -322,7 +329,7 @@
     my @data = <$fh>;
     chomp(@data);
     foreach my $item (@data) {
-        if ($item =~ /^LANG=\"([^\"]*)\"/) {
+        if ($item =~ /^\Q$langvar\E=\"([^\"]*)\"/) {
             my $default = $1;
             if ($default ne 'en_US.UTF-8') {
                 if ($distro =~ /^debian/) {
@@ -386,7 +393,7 @@
         }
     }
     ($recommended{'firewall'},$apachefw) = &chkfirewall($distro);
-    ($recommended{'runlevels'},$tostop) = &chkconfig($distro);
+    ($recommended{'runlevels'},$tostop) = &chkconfig($distro,$instdir);
     $recommended{'apache'} = &chkapache($distro,$instdir);
     $recommended{'stopsrvcs'} = &chksrvcs($distro,$tostop);
     ($recommended{'download'},$downloadstatus,$filetouse,$production,$testing) 
@@ -442,7 +449,7 @@
 }
 
 sub chkconfig {
-    my ($distro) = @_;
+    my ($distro,$instdir) = @_;
     my (%needfix,%tostop);
     my $checker_bin = '/sbin/chkconfig';
     my %daemon = (
@@ -459,6 +466,7 @@
         @norunlevels = qw/0 2 1 6/;
         $daemon{'mysql'} = 'mysql';
         $daemon{'apache'} = 'apache2';
+        $daemon{'ntp'}    = 'ntp';
         if ($distro =~ /^(suse|sles)9/) {
             $daemon{'apache'} = 'apache';
         }
@@ -534,7 +542,9 @@
             $major = $version;
         }
         if ($major > 10) {
-            $needfix{'insserv'} = &check_SuSEfirewall2_setup();
+            if (&check_SuSEfirewall2_setup($instdir)) {
+                $needfix{'insserv'} = 1;
+            }
         }
     }
     return (\%needfix,\%tostop);
@@ -603,7 +613,7 @@
     } elsif ($distro =~ /^(?:suse|sles)([\d\.]+)$/) {
         my $apache = 'apache';
         if ($1 >= 10) {
-            my $apache = 'apache2';
+            $apache = 'apache2';
         }
         if (!-e "$instdir/default-server.conf") {
             $fixapache = 0;
@@ -1474,6 +1484,8 @@
                             if (($distro =~ /^ubuntu/) && ($version <= 8)) {
                                 $daemon = 'cupsys';
                             }
+                        } elsif ($distro =~ /^(?:suse|sles)/) {
+                            $daemon = 'cups';
                         }
                     }
 	            &print_and_log(`/etc/init.d/$daemon stop`);