version 1.9, 2001/05/09 16:50:53
|
version 1.12, 2002/03/03 00:21:23
|
Line 25
|
Line 25
|
my $suffix=".rpmsave"; |
my $suffix=".rpmsave"; |
my $suffixpragma=""; |
my $suffixpragma=""; |
if ($ARGV[0] eq 'suffix') { |
if ($ARGV[0] eq 'suffix') { |
$suffix=$ARGV[1] if $suffix=~/^[\.\w]+$/; |
$suffix=$ARGV[1] if $ARGV[1]=~/^[\.\w]+$/; |
} |
} |
elsif ($ARGV[0] eq 'lasttimestamp') { |
elsif ($ARGV[0] eq 'lasttimestamp') { |
$suffixpragma="lasttimestamp"; |
$suffixpragma="lasttimestamp"; |
Line 36 use strict;
|
Line 36 use strict;
|
|
|
my @special_conf_files=( |
my @special_conf_files=( |
"/etc/httpd/conf/access.conf", |
"/etc/httpd/conf/access.conf", |
"/etc/smb.conf" |
"/etc/smb.conf", |
|
"/etc/samba/smb.conf" |
); |
); |
|
|
my @generic_conf_files=( |
my @generic_conf_files=( |
Line 44 my @generic_conf_files=(
|
Line 45 my @generic_conf_files=(
|
"/home/httpd/lonTabs/spare.tab", |
"/home/httpd/lonTabs/spare.tab", |
"/etc/krb.conf", |
"/etc/krb.conf", |
"/etc/ntp.conf", |
"/etc/ntp.conf", |
|
"/etc/httpd/conf/srm.conf", |
|
"/etc/httpd/conf/httpd.conf", |
); |
); |
|
|
my @perlsetvars=("lonHostID","lonRole","lonAdmEMail","lonDefDomain","lonLoadLim","lonExpire","lonReceipt","lonSqlAccess"); |
my @perlsetvars=("lonHostID","lonRole","lonAdmEMail","lonDefDomain","lonLoadLim","lonExpire","lonReceipt","lonSqlAccess"); |
Line 54 foreach (@special_conf_files) {
|
Line 57 foreach (@special_conf_files) {
|
$suffix=getsuffix('/etc/httpd/conf/access.conf'); |
$suffix=getsuffix('/etc/httpd/conf/access.conf'); |
} |
} |
my $template=`/bin/cat /etc/httpd/conf/access.conf`; |
my $template=`/bin/cat /etc/httpd/conf/access.conf`; |
my $rpmsave=`/bin/cat /etc/httpd/conf/access.conf$suffix`; |
my $lpmlnew=`/bin/cat /etc/httpd/conf/access.conf$suffix`; |
`/bin/mv /etc/httpd/conf/access.conf /etc/httpd/conf/access.conf.template`; |
# `/bin/mv /etc/httpd/conf/access.conf /etc/httpd/conf/access.conf.template`; |
foreach my $psv (@perlsetvars) { |
foreach my $psv (@perlsetvars) { |
$rpmsave=~/\nPerlSetVar\s+$psv\s+(\S+)/; |
if ($template=~/\nPerlSetVar\s+$psv\s+(\S+)/) { |
my $pval=$1; |
my $pval=$1; |
$template=~s/(\nPerlSetVar\s+$psv\s+)\S+/$1$pval/; |
$lpmlnew=~s/(\nPerlSetVar\s+$psv\s+)\S+/$1$pval/; |
$pvar{$psv}=$pval; |
$pvar{$psv}=$pval; |
|
} |
} |
} |
open OUT,">/etc/httpd/conf/access.conf"; |
open OUT,">/etc/httpd/conf/access.conf$suffix"; |
print OUT $template; |
print OUT $lpmlnew; |
close OUT; |
close OUT; |
} |
} |
if (/^\/etc\/smb.conf$/) { |
if (/^\/etc\/smb.conf$/ and -e "/etc/smb.conf$suffix") { |
if ($suffixpragma eq 'lasttimestamp') { |
if ($suffixpragma eq 'lasttimestamp') { |
$suffix=getsuffix('/etc/smb.conf'); |
$suffix=getsuffix('/etc/smb.conf'); |
} |
} |
my $template=`/bin/cat /etc/smb.conf`; |
my $template=`/bin/cat /etc/smb.conf$suffix`; |
|
foreach my $psv (@perlsetvars) { |
|
$template=~s/\{\{\{\{\[(.*?)\]\}\}\}\}/$pvar{$1}/ge; |
|
} |
|
open OUT,">/etc/smb.conf$suffix"; |
|
print OUT $template; |
|
close OUT; |
|
} |
|
if (/^\/etc\/samba\/smb.conf$/ and -e "/etc/samba/smb.conf$suffix") { |
|
if ($suffixpragma eq 'lasttimestamp') { |
|
$suffix=getsuffix('/etc/samba/smb.conf'); |
|
} |
|
my $template=`/bin/cat /etc/samba/smb.conf$suffix`; |
foreach my $psv (@perlsetvars) { |
foreach my $psv (@perlsetvars) { |
$template=~s/\{\{\{\{\[(.*?)\]\}\}\}\}/$pvar{$1}/ge; |
$template=~s/\{\{\{\{\[(.*?)\]\}\}\}\}/$pvar{$1}/ge; |
} |
} |
open OUT,">/etc/smb.conf"; |
open OUT,">/etc/samba/smb.conf$suffix"; |
print OUT $template; |
print OUT $template; |
close OUT; |
close OUT; |
} |
} |
} |
} |
|
|
|
exit; # Just because this is only about restoring configuration to |
|
# new files |
|
|
foreach (@generic_conf_files) { |
foreach (@generic_conf_files) { |
my $file=$_; |
my $file=$_; |
if ($suffixpragma eq 'lasttimestamp') { |
if ($suffixpragma eq 'lasttimestamp') { |