Diff for /doc/install/linux/install.pl between versions 1.94 and 1.96

version 1.94, 2024/08/01 12:56:58 version 1.96, 2024/11/26 22:08:36
Line 732  sub check_mysql_running { Line 732  sub check_mysql_running {
             $proc_owner = 'mysql';              $proc_owner = 'mysql';
             $process = 'mysqld';              $process = 'mysqld';
         }          }
         if ($1 >= 15) {          if ($1 >= 12) {
             $mysqldaemon ='mariadb';              $mysqldaemon ='mariadb';
         }          }
     } elsif ($distro =~ /^suse(\d+)/) {      } elsif ($distro =~ /^suse(\d+)/) {
Line 818  sub chkconfig { Line 818  sub chkconfig {
                     $uses_systemctl{'ntp'} = 1;                      $uses_systemctl{'ntp'} = 1;
                     $uses_systemctl{'cups'} = 1;                      $uses_systemctl{'cups'} = 1;
                     $uses_systemctl{'memcached'} = 1;                      $uses_systemctl{'memcached'} = 1;
                     if (($name eq 'sles') && ($num >= 15)) {                      if ($name eq 'sles') {
                         $daemon{'ntp'} = 'chronyd';                          if ($num >= 12) {
                         $daemon{'mysql'} = 'mariadb';                              $daemon{'mysql'} = 'mariadb';
                           }
                           if ($num >= 15) {
                               $daemon{'ntp'} = 'chronyd';
                           } else {
                               $daemon{'ntp'} = 'ntpd';
                           }
                     } else {                      } else {
                         $daemon{'ntp'} = 'ntpd';                          $daemon{'ntp'} = 'ntpd';
                     }                      }
Line 850  sub chkconfig { Line 856  sub chkconfig {
             (($distro  =~ /^debian/) && ($version >= 10))) {              (($distro  =~ /^debian/) && ($version >= 10))) {
             $daemon{'ntp'}    = 'chrony';              $daemon{'ntp'}    = 'chrony';
         }          }
         if (($distro  =~ /^debian/) && ($version >= 11)) {          if (($distro  =~ /^debian/) && ($version >= 10)) {
             $daemon{'mysql'} = 'mariadb';              $daemon{'mysql'} = 'mariadb';
         }          }
     } elsif ($distro =~ /^fedora(\d+)/) {      } elsif ($distro =~ /^fedora(\d+)/) {
Line 2973  sub check_systemd_update { Line 2979  sub check_systemd_update {
             if (-d '/etc/systemd/system/'.$service.'.d') {              if (-d '/etc/systemd/system/'.$service.'.d') {
                 if (-e '/etc/systemd/system/'.$service.'.d/override.conf') {                  if (-e '/etc/systemd/system/'.$service.'.d/override.conf') {
                     if (open(my $fh,'<','/etc/systemd/system/'.$service.'.d/override.conf')) {                      if (open(my $fh,'<','/etc/systemd/system/'.$service.'.d/override.conf')) {
                         my ($inservice,$addservice,$protectoff,$linenum,$change,@lines);                          my ($category,$addservice,$protectoff,$linenum,$change,
                               %lines,@move,@nocat,@ordered);
                           $linenum = 0;
                         while (my $entry = <$fh>) {                          while (my $entry = <$fh>) {
                             $linenum ++;                              $linenum ++;
                             chomp($entry);                              chomp($entry);
                             if ($entry eq '[Service]') {                              if ($entry =~ /^\s*\[([^\]]+)\]\s*$/) {
                                 if (!$protectoff) {                                  $category = $1;
                                     $inservice = $linenum;                                  if ($category =~ /^Service$/i) {
                                     push(@lines,$entry);                                      push(@ordered,'Service');
                                 } else {                                  } else {
                                     $addservice = 1;                                      push(@ordered,$category);
                                     next;  
                                 }                                  }
                             }                              } elsif ($entry =~ /^ProtectHome\s*=\s*([\w-]+)\s*$/) {
                             if ($entry =~ /^ProtectHome\s*=\s*([\w-]+)\s*$/) {  
                                 my $value = $1;                                  my $value = $1;
                                 if ($protectoff) {                                  next if ($protectoff);
                                     next;                                  if (lc($value) eq 'no') {
                                     if (lc($value) eq 'no') {                                      if ($category =~ /^Service$/i) {
                                         $protectoff = $linenum;                                          push(@{$lines{'Service'}},$entry);
                                         push(@lines,$entry);  
                                     } else {                                      } else {
                                         if ($protectoff) {                                          push(@move,$entry);
                                             next;                                          $change = $linenum;
                                         } else {  
                                             push(@lines,'ProtectHome=no');  
                                             $protectoff = $linenum;  
                                             $change = $linenum;  
                                         }  
                                     }                                      }
                                   } else {
                                       if ($category =~ /^Service$/i) {
                                           push(@{$lines{'Service'}},'ProtectHome=no');
                                       } else {
                                           push(@move,'ProtectHome=no');
                                       }
                                       $change = $linenum;
                                   }
                                   $protectoff = $linenum;
                               } else {
                                   next if ($entry =~ /^\s*$/);
                                   if ($category =~ /^Service$/i) {
                                       push(@{$lines{'Service'}},$entry);
                                   } elsif ($category ne '') {
                                       push(@{$lines{$category}},$entry);
                                   } else {
                                       push(@nocat,$entry);
                                 }                                  }
                             }                              }
                         }                          }
                         close($fh);                          close($fh);
                           unless (grep(/^Service$/,@ordered)) {
                               $addservice = 1;
                               unshift(@ordered,'Service');
                           }
                           if (!$protectoff) {
                               push(@{$lines{'Service'}},'ProtectHome=no');
                           }
                         if ($addservice || $change || !$protectoff) {                          if ($addservice || $change || !$protectoff) {
                             if (open(my $fh,'>','/etc/systemd/system/'.$service.'.d/override.conf')) {                              if (open(my $fh,'>','/etc/systemd/system/'.$service.'.d/override.conf')) {
                                 if ($addservice) {                                  if (@ordered) {
                                     print $fh "[Service]\n";                                      foreach my $category (@ordered) {
                                           print $fh "[$category]\n";
                                           if (ref($lines{$category}) eq 'ARRAY') {
                                               foreach my $item (@{$lines{$category}}) {
                                                   print $fh "$item\n";
                                               }
                                           }
                                           if ($category eq 'Service') {
                                               if (@move) {
                                                   foreach my $item (@move) {
                                                       if ($item =~ /^ProtectHome\s*=\s*no\s*$/i) {
                                                           unless (grep/^ProtectHome\s*=\s*no\s*$/i,@{$lines{$category}}) {
                                                               print $fh "$item\n";
                                                           }
                                                       } else {
                                                           print $fh "$item\n";
                                                       }
                                                   }
                                               }
                                           }
                                           print $fh "\n";
                                       }
                                 }                                  }
                                 foreach my $entry (@lines) {                                  if (@nocat) {
                                     print $fh "$entry\n";                                      foreach my $item (@nocat) {
                                           print $fh "$item\n";
                                       }
                                 }                                  }
                                 close($fh);                                  close($fh);
                                 print_and_log('Updated /etc/systemd/system/'.$service.'.d/override.conf');                                  print_and_log('Updated /etc/systemd/system/'.$service.'.d/override.conf');

Removed from v.1.94  
changed lines
  Added in v.1.96


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