Diff for /doc/install/linux/install.pl between versions 1.34 and 1.35

version 1.34, 2014/12/19 20:23:36 version 1.35, 2015/01/02 13:34:08
Line 386  sub check_required { Line 386  sub check_required {
         return ($distro,$gotprereqs,$localecmd);          return ($distro,$gotprereqs,$localecmd);
     }      }
     my ($mysqlon,$mysqlsetup,$mysqlrestart,$dbh,$has_pass,$has_lcdb,%recommended,      my ($mysqlon,$mysqlsetup,$mysqlrestart,$dbh,$has_pass,$has_lcdb,%recommended,
         $downloadstatus,$filetouse,$production,$testing,$apachefw,$tostop);          $downloadstatus,$filetouse,$production,$testing,$apachefw,$tostop,$uses_systemctl);
     my $wwwuid = &uid_of_www();      my $wwwuid = &uid_of_www();
     my $wwwgid = getgrnam('www');      my $wwwgid = getgrnam('www');
     if (($wwwuid eq '') || ($wwwgid eq '')) {      if (($wwwuid eq '') || ($wwwgid eq '')) {
Line 424  sub check_required { Line 424  sub check_required {
         }          }
     }      }
     ($recommended{'firewall'},$apachefw) = &chkfirewall($distro);      ($recommended{'firewall'},$apachefw) = &chkfirewall($distro);
     ($recommended{'runlevels'},$tostop) = &chkconfig($distro,$instdir);      ($recommended{'runlevels'},$tostop,$uses_systemctl) = &chkconfig($distro,$instdir);
     $recommended{'apache'} = &chkapache($distro,$instdir);      $recommended{'apache'} = &chkapache($distro,$instdir);
     $recommended{'stopsrvcs'} = &chksrvcs($distro,$tostop);      $recommended{'stopsrvcs'} = &chksrvcs($distro,$tostop);
     ($recommended{'download'},$downloadstatus,$filetouse,$production,$testing)       ($recommended{'download'},$downloadstatus,$filetouse,$production,$testing) 
         = &need_download();          = &need_download();
     return ($distro,$gotprereqs,$localecmd,$packagecmd,$updatecmd,$installnow,      return ($distro,$gotprereqs,$localecmd,$packagecmd,$updatecmd,$installnow,
             $mysqlrestart,\%recommended,$dbh,$has_pass,$has_lcdb,$downloadstatus,              $mysqlrestart,\%recommended,$dbh,$has_pass,$has_lcdb,$downloadstatus,
             $filetouse,$production,$testing,$apachefw);              $filetouse,$production,$testing,$apachefw,$uses_systemctl);
 }  }
   
 sub check_mysql_running {  sub check_mysql_running {
Line 448  sub check_mysql_running { Line 448  sub check_mysql_running {
             $process = 'mysqld';              $process = 'mysqld';
             $proc_owner = 'mysql';              $proc_owner = 'mysql';
         }          }
     }      } elsif ($distro =~ /^fedora(\d+)/) {
     if ($distro =~ /^fedora(\d+)/) {  
         if ($1 >= 16) {          if ($1 >= 16) {
             $process = 'mysqld';              $process = 'mysqld';
             $proc_owner = 'mysql';              $proc_owner = 'mysql';
             $use_systemctl = 1;              $use_systemctl = 1;
         }          }
     }      } elsif ($distro =~ /^(?:centos|rhes|scientific)(\d+)/) {
     if ($distro =~ /^(?:centos|rhes|scientific)(\d+)/) {  
         if ($1 >= 7) {          if ($1 >= 7) {
             $mysqldaemon ='mariadb';              $mysqldaemon ='mariadb';
             $process = 'mysqld';              $process = 'mysqld';
             $proc_owner = 'mysql';              $proc_owner = 'mysql';
             $use_systemctl = 1;              $use_systemctl = 1;
         }          }
       } elsif ($distro =~ /^sles(\d+)/) {
           if ($1 >= 12) {
               $use_systemctl = 1;
           }
       } elsif ($distro =~ /^suse(\d+)/) {
           if ($1 >= 13) {
               $use_systemctl = 1;
           }
     }      }
     if (open(PIPE,"ps -ef |grep $process |grep ^$proc_owner 2>&1 |")) {      if (open(PIPE,"ps -ef |grep $process |grep ^$proc_owner |grep -v grep 2>&1 |")) {
         my $status = <PIPE>;          my $status = <PIPE>;
         close(PIPE);          close(PIPE);
         chomp($status);          chomp($status);
Line 532  sub chkconfig { Line 538  sub chkconfig {
         if ($distro =~ /^(suse|sles)9/) {          if ($distro =~ /^(suse|sles)9/) {
             $daemon{'apache'} = 'apache';              $daemon{'apache'} = 'apache';
         }          }
         if ($distro =~ /^suse(\d+)/) {          if ($distro =~ /^(suse|sles)([\d\.]+)/) {
             if ($1 > 11) {              my $name = $1;
               my $num = $2;
               if ($num > 11) {
                 $uses_systemctl{'apache'} = 1;                  $uses_systemctl{'apache'} = 1;
                   if (($name eq 'sles') || ($name eq 'suse' && $num >= 13.2)) {
                       $uses_systemctl{'mysql'} = 1;
                       $uses_systemctl{'ntp'} = 1;
                       $uses_systemctl{'cups'} = 1;
                       $uses_systemctl{'memcached'} = 1;
                       $daemon{'ntp'} = 'ntpd';
                   }
             }              }
         }          }
     } elsif ($distro =~ /^(?:debian|ubuntu)(\d+)/) {      } elsif ($distro =~ /^(?:debian|ubuntu)(\d+)/) {
Line 556  sub chkconfig { Line 571  sub chkconfig {
         if ($version >= 16) {          if ($version >= 16) {
             $uses_systemctl{'mysql'} = 1;              $uses_systemctl{'mysql'} = 1;
             $uses_systemctl{'apache'} = 1;              $uses_systemctl{'apache'} = 1;
               $uses_systemctl{'memcached'} = 1;
               $uses_systemctl{'cups'} = 1;
         }          }
     } elsif ($distro =~ /^(?:centos|rhes|scientific)(\d+)/) {      } elsif ($distro =~ /^(?:centos|rhes|scientific)(\d+)/) {
         my $version = $1;          my $version = $1;
Line 563  sub chkconfig { Line 580  sub chkconfig {
             $uses_systemctl{'ntp'} = 1;              $uses_systemctl{'ntp'} = 1;
             $uses_systemctl{'mysql'} = 1;              $uses_systemctl{'mysql'} = 1;
             $uses_systemctl{'apache'} = 1;              $uses_systemctl{'apache'} = 1;
               $uses_systemctl{'memcached'} = 1;
               $uses_systemctl{'cups'} = 1;
             $daemon{'mysql'} = 'mariadb';              $daemon{'mysql'} = 'mariadb';
         }          }
     }      }
Line 586  sub chkconfig { Line 605  sub chkconfig {
     foreach my $type ('apache','mysql','ntp','cups','memcached') {      foreach my $type ('apache','mysql','ntp','cups','memcached') {
         my $service = $daemon{$type};          my $service = $daemon{$type};
         if ($uses_systemctl{$type}) {          if ($uses_systemctl{$type}) {
             if (!-l "/etc/systemd/system/multi-user.target.wants/$service.service") {              if (($type eq 'memcached') || ($type eq 'cups')) {
                 $needfix{$type} = "systemctl enable $service.service";                  if (-l "/etc/systemd/system/multi-user.target.wants/$service.service") {
                       $tostop{$type} = 1;
                   }
               } else {
                   if (!-l "/etc/systemd/system/multi-user.target.wants/$service.service") {
                       $needfix{$type} = "systemctl enable $service.service";
                   }
             }              }
             next;  
         } else {          } else {
             my $command = $checker_bin.' --list '.$service.' 2>/dev/null';              my $command = $checker_bin.' --list '.$service.' 2>/dev/null';
             if ($type eq 'cups') {               if ($type eq 'cups') {
                 if ($distro =~ /^(?:debian|ubuntu)(\d+)/) {                  if ($distro =~ /^(?:debian|ubuntu)(\d+)/) {
                     my $version = $1;                      my $version = $1;
                     if (($distro =~ /^ubuntu/) && ($version <= 8)) {                      if (($distro =~ /^ubuntu/) && ($version <= 8)) {
Line 649  sub chkconfig { Line 673  sub chkconfig {
             }              }
         }          }
     }      }
     return (\%needfix,\%tostop);      return (\%needfix,\%tostop,\%uses_systemctl);
 }  }
   
 sub chkfirewall {  sub chkfirewall {
Line 1249  print "\n".&mt('Checking system status . Line 1273  print "\n".&mt('Checking system status .
 my $dsn = "DBI:mysql:database=mysql";  my $dsn = "DBI:mysql:database=mysql";
 my ($distro,$gotprereqs,$localecmd,$packagecmd,$updatecmd,$installnow,$mysqlrestart,  my ($distro,$gotprereqs,$localecmd,$packagecmd,$updatecmd,$installnow,$mysqlrestart,
     $recommended,$dbh,$has_pass,$has_lcdb,$downloadstatus,$filetouse,$production,      $recommended,$dbh,$has_pass,$has_lcdb,$downloadstatus,$filetouse,$production,
     $testing,$apachefw) = &check_required($instdir,$dsn);      $testing,$apachefw,$uses_systemctl) = &check_required($instdir,$dsn);
 if ($distro eq '') {  if ($distro eq '') {
     print "\n".&mt('Linux distribution could not be verified as a supported distribution.')."\n".      print "\n".&mt('Linux distribution could not be verified as a supported distribution.')."\n".
           &mt('The following are supported: [_1].',            &mt('The following are supported: [_1].',
Line 1293  if (!$gotprereqs) { Line 1317  if (!$gotprereqs) {
                 } else {                  } else {
                     ($distro,$gotprereqs,$localecmd,$packagecmd,$updatecmd,$installnow,                      ($distro,$gotprereqs,$localecmd,$packagecmd,$updatecmd,$installnow,
                      $mysqlrestart,$recommended,$dbh,$has_pass,$has_lcdb,$downloadstatus,                       $mysqlrestart,$recommended,$dbh,$has_pass,$has_lcdb,$downloadstatus,
                      $filetouse,$production,$testing,$apachefw) =                        $filetouse,$production,$testing,$apachefw,$uses_systemctl) = 
                      &check_required($instdir,$dsn);                       &check_required($instdir,$dsn);
                 }                  }
             } else {              } else {
Line 1708  sub kill_extra_services { Line 1732  sub kill_extra_services {
                     if ($distro =~ /^(debian|ubuntu)/) {                      if ($distro =~ /^(debian|ubuntu)/) {
                         &print_and_log(`update-rc.d -f $daemon remove`);                          &print_and_log(`update-rc.d -f $daemon remove`);
                     } else {                      } else {
                 &print_and_log(`/sbin/chkconfig --del $service`);                          if (ref($uses_systemctl) eq 'HASH') {
                               if ($uses_systemctl->{$service}) {
                                   if (`systemctl is-enabled $service`) {                          
                                       &print_and_log(`systemctl disable $service`);
                                   }
                               } else {
                                   &print_and_log(`/sbin/chkconfig --del $service`);
                               }
                           } else {
                       &print_and_log(`/sbin/chkconfig --del $service`);
                           } 
                     }                      }
                 }                  }
             }              }
Line 1839  sub get_mysql_version { Line 1873  sub get_mysql_version {
         my $info = <PIPE>;          my $info = <PIPE>;
         chomp($info);          chomp($info);
         close(PIPE);          close(PIPE);
         ($version) = ($info =~ /(\d+\.\d+)\.\d+,/);            ($version) = ($info =~ /(\d+\.\d+)\.\d+[\-\w]*,/);
     } else {      } else {
         print &mt('Could not determine which version of MySQL is installed.').          print &mt('Could not determine which version of MySQL is installed.').
               "\n";                "\n";

Removed from v.1.34  
changed lines
  Added in v.1.35


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>