[LON-CAPA-cvs] cvs: loncom /debugging_tools modify_config_files.pl
raeburn
raeburn at source.lon-capa.org
Sat Mar 13 14:38:32 EST 2021
raeburn Sat Mar 13 19:38:32 2021 EDT
Modified files:
/loncom/debugging_tools modify_config_files.pl
Log:
- Use three-argument open() to separate file mode from the filename.
- For ubuntu and debian, trailing slash in repo URL is optional in
regexp, and omitted from text, for consistency with install instructions.
Index: loncom/debugging_tools/modify_config_files.pl
diff -u loncom/debugging_tools/modify_config_files.pl:1.17 loncom/debugging_tools/modify_config_files.pl:1.18
--- loncom/debugging_tools/modify_config_files.pl:1.17 Sat Mar 13 18:10:00 2021
+++ loncom/debugging_tools/modify_config_files.pl Sat Mar 13 19:38:32 2021
@@ -2,7 +2,7 @@
#
# The LearningOnline Network
#
-# $Id: modify_config_files.pl,v 1.17 2021/03/13 18:10:00 raeburn Exp $
+# $Id: modify_config_files.pl,v 1.18 2021/03/13 19:38:32 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -202,40 +202,40 @@
} elsif ($dist =~ /^(debian|ubuntu)\d+$/) {
my %apt_get_source = (
debian5 => {
- regexp => '\s*deb\s+'.$loninst_re.'/debian/\s+lenny\s+main',
- text => "deb $loninst/debian/ lenny main",
+ regexp => '\s*deb\s+'.$loninst_re.'/debian/?\s+lenny\s+main',
+ text => "deb $loninst/debian lenny main",
},
ubuntu6 => {
- regexp => '\s*deb\s+'.$loninst_re.'/ubuntu/\s+dapper\s+main',
- text => "deb $loninst/ubuntu/ dapper main",
+ regexp => '\s*deb\s+'.$loninst_re.'/ubuntu/?\s+dapper\s+main',
+ text => "deb $loninst/ubuntu dapper main",
},
ubuntu8 => {
- regexp => '\s*deb\s+'.$loninst_re.'/ubuntu/\s+hardy\s+main',
- text => "deb $loninst/ubuntu/ hardy main",
+ regexp => '\s*deb\s+'.$loninst_re.'/ubuntu/?\s+hardy\s+main',
+ text => "deb $loninst/ubuntu hardy main",
},
ubuntu10 => {
- regexp => '\s*deb\s+'.$loninst_re.'/ubuntu/\s+lucid\s+main',
- text => "deb $loninst/ubuntu/ lucid main",
+ regexp => '\s*deb\s+'.$loninst_re.'/ubuntu/?\s+lucid\s+main',
+ text => "deb $loninst/ubuntu lucid main",
},
ubuntu12 => {
- regexp => '\s*deb\s+'.$loninst_re.'/ubuntu/\s+precise\s+main',
- text => "deb $loninst/ubuntu/ precise main",
+ regexp => '\s*deb\s+'.$loninst_re.'/ubuntu/?\s+precise\s+main',
+ text => "deb $loninst/ubuntu precise main",
},
ubuntu14 => {
- regexp => '\s*deb\s+'.$loninst_re.'/ubuntu/\s+trusty\s+main',
- text => "deb $loninst/ubuntu/ trusty main",
+ regexp => '\s*deb\s+'.$loninst_re.'/ubuntu/?\s+trusty\s+main',
+ text => "deb $loninst/ubuntu trusty main",
},
ubuntu16 => {
- regexp => '\s*deb\s+'.$loninst_re.'/ubuntu/\s+xenial\s+main',
- text => "deb $loninst/ubuntu/ xenial main",
+ regexp => '\s*deb\s+'.$loninst_re.'/ubuntu/?\s+xenial\s+main',
+ text => "deb $loninst/ubuntu xenial main",
},
ubuntu18 => {
- regexp => '\s*deb\s+'.$loninst_re.'/ubuntu/\s+bionic\s+main',
- text => "deb $loninst/ubuntu/ bionic main",
+ regexp => '\s*deb\s+'.$loninst_re.'/ubuntu/?\s+bionic\s+main',
+ text => "deb $loninst/ubuntu bionic main",
},
ubuntu20 => {
- regexp => '\s*deb\s+'.$loninst_re.'/ubuntu/\s+focal\s+main',
- text => "deb $loninst/ubuntu/ focal main",
+ regexp => '\s*deb\s+'.$loninst_re.'/ubuntu/?\s+focal\s+main',
+ text => "deb $loninst/ubuntu focal main",
},
);
my $apt_status;
@@ -376,7 +376,7 @@
if (! defined($structure) || ! ref($structure)) {
return 'Bad subroutine inputs';
}
- open(OUTPUT,'>'.$file) || return('Unable to open '.$file.' for writing');
+ open(OUTPUT,'>',$file) || return('Unable to open '.$file.' for writing');
for (my $i=0;$i<scalar(@$structure);$i++) {
my $line = $structure->[$i];
chomp($line);
@@ -519,7 +519,7 @@
}
my $result = 0;
my $fh;
- if (open($fh,"<$file")) {
+ if (open($fh,'<',$file)) {
my $total = 0;
my %found;
foreach my $item (keys(%{$rhn_items})) {
@@ -541,7 +541,7 @@
}
close($fh);
if ($total < 2) {
- if (open($fh,">>$file")) {
+ if (open($fh,'>>',$file)) {
foreach my $item (keys(%{$rhn_items})) {
unless ($found{$item}) {
if (ref($rhn_items->{$item}) eq 'HASH') {
@@ -596,7 +596,7 @@
}
my $result = 0;
my $fh;
- if (open($fh,"<$file")) {
+ if (open($fh,'<',$file)) {
my $found = 0;
my $pattern = $deb_row->{regexp};
while(<$fh>) {
@@ -607,7 +607,7 @@
}
close($fh);
if (!$found) {
- if (open($fh,">>$file")) {
+ if (open($fh,'>>',$file)) {
print $fh "\n".$deb_row->{text}."\n";
close($fh);
$result = 1;
More information about the LON-CAPA-cvs
mailing list