Annotation of loncom/build/loncaparestoreconfigurations, revision 1.7
1.1 harris41 1: #!/usr/bin/perl
2:
3: # loncaparestoreconfigurations
4:
5: # This tool helps in updating a system. It takes a list of
6: # .rpmsave files and restores them.
7:
8: # Scott Harrison, 10/25/2000
9:
10: use strict;
11:
12: my @special_conf_files=(
1.5 harris41 13: "/etc/httpd/conf/access.conf",
14: "/etc/smb.conf"
1.1 harris41 15: );
16:
17: my @generic_conf_files=(
18: "/home/httpd/lonTabs/hosts.tab",
19: "/home/httpd/lonTabs/spare.tab",
20: "/etc/krb.conf",
1.4 harris41 21: "/etc/ntp.conf",
1.1 harris41 22: );
23:
1.5 harris41 24: my @perlsetvars=("lonHostID","lonRole","lonAdmEMail","lonDefDomain","lonLoadLim","lonExpire");
1.6 harris41 25: my %pvar;
1.1 harris41 26: foreach (@special_conf_files) {
1.3 harris41 27: if (/^\/etc\/httpd\/conf\/access.conf$/) {
1.2 harris41 28: my $template=`/bin/cat /etc/httpd/conf/access.conf`;
29: my $rpmsave=`/bin/cat /etc/httpd/conf/access.conf.rpmsave`;
30: `/bin/mv /etc/httpd/conf/access.conf /etc/httpd/conf/access.conf.template`;
31: foreach my $psv (@perlsetvars) {
32: $rpmsave=~/\nPerlSetVar\s+$psv\s+(\S+)/;
33: my $pval=$1;
34: $template=~s/(\nPerlSetVar\s+$psv\s+)\S+/$1$pval/;
1.5 harris41 35: $pvar{$psv}=$pval;
1.2 harris41 36: }
37: open OUT,">/etc/httpd/conf/access.conf";
1.5 harris41 38: print OUT $template;
39: close OUT;
40: }
41: if (/^\/etc\/smb.conf$/) {
1.7 ! harris41 42: my $template=`/bin/cat /etc/smb.conf`;
1.5 harris41 43: foreach my $psv (@perlsetvars) {
44: $template=~s/\{\{\{\{\[(.*?)\]\}\}\}\}/$pvar{$1}/ge;
45: }
46: open OUT,">/etc/smb.conf";
1.2 harris41 47: print OUT $template;
48: close OUT;
1.1 harris41 49: }
50: }
51:
52: foreach (@generic_conf_files) {
1.3 harris41 53: if (-e "$_.rpmsave") {
54: `/bin/mv $_ $_.template`;
55: `/bin/mv $_.rpmsave $_`;
56: }
1.1 harris41 57: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>