[LON-CAPA-cvs] cvs: loncom /build loncaparestoreconfigurations

harris41 lon-capa-cvs@mail.lon-capa.org
Sun, 03 Mar 2002 00:21:23 -0000


harris41		Sat Mar  2 19:21:23 2002 EDT

  Modified files:              
    /loncom/build	loncaparestoreconfigurations 
  Log:
  should process samba.conf on redhat7.* systems now...
  also fixes weird formatting problem by only substituting
  when there is something to substitute
  
  
Index: loncom/build/loncaparestoreconfigurations
diff -u loncom/build/loncaparestoreconfigurations:1.11 loncom/build/loncaparestoreconfigurations:1.12
--- loncom/build/loncaparestoreconfigurations:1.11	Tue Nov 27 18:23:47 2001
+++ loncom/build/loncaparestoreconfigurations	Sat Mar  2 19:21:23 2002
@@ -36,7 +36,8 @@
 
 my @special_conf_files=(
 			"/etc/httpd/conf/access.conf",
-			"/etc/smb.conf"
+			"/etc/smb.conf",
+			"/etc/samba/smb.conf"
 			);
 
 my @generic_conf_files=(
@@ -59,16 +60,17 @@
 	my $lpmlnew=`/bin/cat /etc/httpd/conf/access.conf$suffix`;
 #	`/bin/mv /etc/httpd/conf/access.conf /etc/httpd/conf/access.conf.template`;
 	foreach my $psv (@perlsetvars) {
-	    $template=~/\nPerlSetVar\s+$psv\s+(\S+)/;
-	    my $pval=$1;
-	    $lpmlnew=~s/(\nPerlSetVar\s+$psv\s+)\S+/$1$pval/;
-	    $pvar{$psv}=$pval;
+	    if ($template=~/\nPerlSetVar\s+$psv\s+(\S+)/) {
+		my $pval=$1;
+		$lpmlnew=~s/(\nPerlSetVar\s+$psv\s+)\S+/$1$pval/;
+		$pvar{$psv}=$pval;
+	    }
 	}
 	open OUT,">/etc/httpd/conf/access.conf$suffix";
 	print OUT $lpmlnew;
 	close OUT;
     }
-    if (/^\/etc\/smb.conf$/) {
+    if (/^\/etc\/smb.conf$/ and -e "/etc/smb.conf$suffix") {
 	if ($suffixpragma eq 'lasttimestamp') {
 	    $suffix=getsuffix('/etc/smb.conf');
 	}
@@ -77,6 +79,18 @@
 	    $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) {
+	    $template=~s/\{\{\{\{\[(.*?)\]\}\}\}\}/$pvar{$1}/ge;
+	}
+	open OUT,">/etc/samba/smb.conf$suffix";
 	print OUT $template;
 	close OUT;
     }