Annotation of loncom/build/loncaparestoreconfigurations, revision 1.2

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=(
                     13: 			"/etc/httpd/conf/access.conf"
                     14: 			);
                     15: 
                     16: my @generic_conf_files=(
                     17: 			"/home/httpd/lonTabs/hosts.tab",
                     18: 			"/home/httpd/lonTabs/spare.tab",
                     19: 			"/etc/krb.conf",
                     20: 			"/etc/ntp.conf"
                     21: 			);
                     22: 
                     23: foreach (@special_conf_files) {
                     24:     if (/^/etc/httpd/conf/access.conf$/) {
1.2     ! harris41   25: 	my $template=`/bin/cat /etc/httpd/conf/access.conf`;
        !            26: 	my $rpmsave=`/bin/cat /etc/httpd/conf/access.conf.rpmsave`;
        !            27: 	`/bin/mv /etc/httpd/conf/access.conf /etc/httpd/conf/access.conf.template`;
1.1       harris41   28: 	my @perlsetvars=("lonHostID","lonRole","lonAdmEMail","lonDefDomain","lonLoadLim","lonExpire");
1.2     ! harris41   29: 	foreach my $psv (@perlsetvars) {
        !            30: 	    $rpmsave=~/\nPerlSetVar\s+$psv\s+(\S+)/;
        !            31: 	    my $pval=$1;
        !            32: 	    $template=~s/(\nPerlSetVar\s+$psv\s+)\S+/$1$pval/;
        !            33: 	}
        !            34: 	open OUT,">/etc/httpd/conf/access.conf";
        !            35: 	print OUT $template;
        !            36: 	close OUT;
1.1       harris41   37:     }
                     38: }
                     39: 
                     40: foreach (@generic_conf_files) {
                     41:     `/bin/mv $_ $_.template`;
                     42:     `/bin/mv $_.rpmsave $_`;
                     43: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>