--- loncom/debugging_tools/modify_config_files.pl 2021/03/13 18:10:00 1.17 +++ loncom/debugging_tools/modify_config_files.pl 2021/03/13 19:38:32 1.18 @@ -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 @@ if ($dist =~ /^fedora(\d+)$/) { } 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 @@ sub write_config_file { 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[$i]; chomp($line); @@ -519,7 +519,7 @@ sub update_rhn_source { } 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 @@ sub update_rhn_source { } 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 @@ sub update_apt_source { } 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 @@ sub update_apt_source { } close($fh); if (!$found) { - if (open($fh,">>$file")) { + if (open($fh,'>>',$file)) { print $fh "\n".$deb_row->{text}."\n"; close($fh); $result = 1;