[LON-CAPA-cvs] cvs: doc /install/linux install.pl
raeburn
raeburn at source.lon-capa.org
Fri Jan 2 08:34:09 EST 2015
raeburn Fri Jan 2 13:34:09 2015 EDT
Modified files:
/doc/install/linux install.pl
Log:
- Support for SLES12 and SuSE 13.2
- Support stopping of unnecessary services (cups and memcached) for distro
versions which use systemctl in place of chkconfig for these services.
Index: doc/install/linux/install.pl
diff -u doc/install/linux/install.pl:1.34 doc/install/linux/install.pl:1.35
--- doc/install/linux/install.pl:1.34 Fri Dec 19 20:23:36 2014
+++ doc/install/linux/install.pl Fri Jan 2 13:34:08 2015
@@ -72,7 +72,7 @@
&mt('Stopping execution.')."\n";
exit;
} else {
- print LOG '$Id: install.pl,v 1.34 2014/12/19 20:23:36 raeburn Exp $'."\n";
+ print LOG '$Id: install.pl,v 1.35 2015/01/02 13:34:08 raeburn Exp $'."\n";
}
#
@@ -386,7 +386,7 @@
return ($distro,$gotprereqs,$localecmd);
}
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 $wwwgid = getgrnam('www');
if (($wwwuid eq '') || ($wwwgid eq '')) {
@@ -424,14 +424,14 @@
}
}
($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{'stopsrvcs'} = &chksrvcs($distro,$tostop);
($recommended{'download'},$downloadstatus,$filetouse,$production,$testing)
= &need_download();
return ($distro,$gotprereqs,$localecmd,$packagecmd,$updatecmd,$installnow,
$mysqlrestart,\%recommended,$dbh,$has_pass,$has_lcdb,$downloadstatus,
- $filetouse,$production,$testing,$apachefw);
+ $filetouse,$production,$testing,$apachefw,$uses_systemctl);
}
sub check_mysql_running {
@@ -448,23 +448,29 @@
$process = 'mysqld';
$proc_owner = 'mysql';
}
- }
- if ($distro =~ /^fedora(\d+)/) {
+ } elsif ($distro =~ /^fedora(\d+)/) {
if ($1 >= 16) {
$process = 'mysqld';
$proc_owner = 'mysql';
$use_systemctl = 1;
}
- }
- if ($distro =~ /^(?:centos|rhes|scientific)(\d+)/) {
+ } elsif ($distro =~ /^(?:centos|rhes|scientific)(\d+)/) {
if ($1 >= 7) {
$mysqldaemon ='mariadb';
$process = 'mysqld';
$proc_owner = 'mysql';
$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>;
close(PIPE);
chomp($status);
@@ -532,9 +538,18 @@
if ($distro =~ /^(suse|sles)9/) {
$daemon{'apache'} = 'apache';
}
- if ($distro =~ /^suse(\d+)/) {
- if ($1 > 11) {
+ if ($distro =~ /^(suse|sles)([\d\.]+)/) {
+ my $name = $1;
+ my $num = $2;
+ if ($num > 11) {
$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+)/) {
@@ -556,6 +571,8 @@
if ($version >= 16) {
$uses_systemctl{'mysql'} = 1;
$uses_systemctl{'apache'} = 1;
+ $uses_systemctl{'memcached'} = 1;
+ $uses_systemctl{'cups'} = 1;
}
} elsif ($distro =~ /^(?:centos|rhes|scientific)(\d+)/) {
my $version = $1;
@@ -563,6 +580,8 @@
$uses_systemctl{'ntp'} = 1;
$uses_systemctl{'mysql'} = 1;
$uses_systemctl{'apache'} = 1;
+ $uses_systemctl{'memcached'} = 1;
+ $uses_systemctl{'cups'} = 1;
$daemon{'mysql'} = 'mariadb';
}
}
@@ -586,13 +605,18 @@
foreach my $type ('apache','mysql','ntp','cups','memcached') {
my $service = $daemon{$type};
if ($uses_systemctl{$type}) {
- if (!-l "/etc/systemd/system/multi-user.target.wants/$service.service") {
- $needfix{$type} = "systemctl enable $service.service";
+ if (($type eq 'memcached') || ($type eq 'cups')) {
+ 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 {
my $command = $checker_bin.' --list '.$service.' 2>/dev/null';
- if ($type eq 'cups') {
+ if ($type eq 'cups') {
if ($distro =~ /^(?:debian|ubuntu)(\d+)/) {
my $version = $1;
if (($distro =~ /^ubuntu/) && ($version <= 8)) {
@@ -649,7 +673,7 @@
}
}
}
- return (\%needfix,\%tostop);
+ return (\%needfix,\%tostop,\%uses_systemctl);
}
sub chkfirewall {
@@ -1249,7 +1273,7 @@
my $dsn = "DBI:mysql:database=mysql";
my ($distro,$gotprereqs,$localecmd,$packagecmd,$updatecmd,$installnow,$mysqlrestart,
$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 '') {
print "\n".&mt('Linux distribution could not be verified as a supported distribution.')."\n".
&mt('The following are supported: [_1].',
@@ -1293,7 +1317,7 @@
} else {
($distro,$gotprereqs,$localecmd,$packagecmd,$updatecmd,$installnow,
$mysqlrestart,$recommended,$dbh,$has_pass,$has_lcdb,$downloadstatus,
- $filetouse,$production,$testing,$apachefw) =
+ $filetouse,$production,$testing,$apachefw,$uses_systemctl) =
&check_required($instdir,$dsn);
}
} else {
@@ -1708,7 +1732,17 @@
if ($distro =~ /^(debian|ubuntu)/) {
&print_and_log(`update-rc.d -f $daemon remove`);
} 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`);
+ }
}
}
}
@@ -1839,7 +1873,7 @@
my $info = <PIPE>;
chomp($info);
close(PIPE);
- ($version) = ($info =~ /(\d+\.\d+)\.\d+,/);
+ ($version) = ($info =~ /(\d+\.\d+)\.\d+[\-\w]*,/);
} else {
print &mt('Could not determine which version of MySQL is installed.').
"\n";
More information about the LON-CAPA-cvs
mailing list