[LON-CAPA-cvs] cvs: loncom /debugging_tools modify_config_files.pl
raeburn
raeburn at source.lon-capa.org
Mon Jun 5 17:06:25 EDT 2017
raeburn Mon Jun 5 21:06:25 2017 EDT
Modified files:
/loncom/debugging_tools modify_config_files.pl
Log:
- Update documentation
- Fedora 21 and newer use /etc/yum.repos.d/loncapa.repo instead of yum.conf
Index: loncom/debugging_tools/modify_config_files.pl
diff -u loncom/debugging_tools/modify_config_files.pl:1.12 loncom/debugging_tools/modify_config_files.pl:1.13
--- loncom/debugging_tools/modify_config_files.pl:1.12 Tue May 31 02:55:15 2011
+++ loncom/debugging_tools/modify_config_files.pl Mon Jun 5 21:06:25 2017
@@ -2,7 +2,7 @@
#
# The LearningOnline Network
#
-# $Id: modify_config_files.pl,v 1.12 2011/05/31 02:55:15 raeburn Exp $
+# $Id: modify_config_files.pl,v 1.13 2017/06/05 21:06:25 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -37,15 +37,19 @@
=head1 SYNOPSIS
This script modifies /etc/my.cnf and one of: /etc/yum.conf
-(for Fedora/CentOS/Scientific Linux/RHEL5), /etc/apt/sources.list
-(for Debian/Ubuntu) and /etc/sysconfig/rhn/sources (for RHEL4).
+(for CentOS/Scientific Linux/RHEL >=5), /etc/apt/sources.list
+(for Debian/Ubuntu), /etc/sysconfig/rhn/sources (for RHEL4),
+and /etc/yum.repos.d/loncapa.repo (Fedora >= 21).
=head1 DESCRIPTION
-This script modifies /etc/my.cnf and /etc/yum.conf or /etc/apt/sources
-or /etc/sysconfig/rhn/sources to ensure certain parameters are set
-properly. The LON-CAPA yum repositories are added to /etc/yum.conf or
-/etc/sysconfig/rhn/sources and the LON-CAPA apt repositories are added to
+This script modifies /etc/my.cnf, /etc/yum.conf, /etc/yum.repos.d/loncapa.repo,
+/etc/apt/sources, or /etc/sysconfig/rhn/sources to ensure certain
+parameters are set properly.
+
+The LON-CAPA yum repositories are added to /etc/yum.conf,
+/etc/yum.repos.d/loncapa.repo, /etc/sysconfig/rhn/sources
+and the LON-CAPA apt repositories are added to
/etc/apt/sources.list.
The /etc/my.cnf file is modified to set the wait_timeout to 1 year. Backup
@@ -69,14 +73,20 @@
my $loninst = 'http://install.loncapa.org';
my $loninst_re = 'http://install\.loncapa\.org';
if ($dist =~ /^fedora(\d+)$/) {
+ my $file = '/etc/yum.conf';
my $ver = $1;
my $gpgchk = '0';
my $gpg = "$loninst/versions/fedora/RPM-GPG-KEY-loncapa";
+ my $nobackup;
if ($ver > 6) {
$gpgchk = '1';
}
+ if ($ver >= 21) {
+ $file = '/etc/yum.repos.d/loncapa.repo';
+ $nobackup = 1;
+ }
$yum_status =
- &update_file('/etc/yum.conf',
+ &update_file($file,
[{section => 'loncapa-updates-basearch',
key => 'name=',
value => 'Fedora Core $releasever LON-CAPA $basearch Updates',
@@ -87,7 +97,7 @@
key => 'gpgcheck=',
value => $gpgchk,
}, {section => 'loncapa-updates-basearch',
- key => 'gpg=',
+ key => 'gpgkey=',
value => $gpg,
}, {section => 'loncapa-updates-noarch',
key => 'name=',
@@ -99,9 +109,9 @@
key => 'gpgcheck=',
value => $gpgchk,
}, {section => 'loncapa-updates-noarch',
- key => 'gpg=',
+ key => 'gpgkey=',
value => $gpg,
- }]);
+ }],$nobackup);
} elsif ($dist =~ /^(rhes|centos|scientific)(\d+)$/) {
my $type = $1;
my $ver = $2;
@@ -225,12 +235,14 @@
sub update_file {
- my ($file,$newdata) = @_;
+ my ($file,$newdata,$nobackup) = @_;
return 1 if (! -e $file);
- my $backup = $file.'.backup';
- if (! copy($file,$backup)) {
- warn "**** Error: Unable to make backup of $file";
- return 0;
+ unless ($nobackup) {
+ my $backup = $file.'.backup';
+ if (! copy($file,$backup)) {
+ warn "**** Error: Unable to make backup of $file";
+ return 0;
+ }
}
my ($filedata) = &parse_config_file($file);
if (! ref($filedata)) { warn "**** Error: $filedata"; return 0;}
More information about the LON-CAPA-cvs
mailing list