# # RewriteConf.awk script to rewrite the @@ServerRoot@@ tags in httpd.conf # # Note that we -don't- want the ARGV file list, so no additional {} blocks # are coded. Use explicit args (more reliable on Win32) and use the fact # that ARGV[] params are -not- '\' escaped to process the C:\Foo\Bar Win32 # path format. Note that awk var=path would not succeed, since it -does- # '\' escape the assignment. # BEGIN { confroot = ARGV[1]; gsub( /\\/, "/", confroot ); confroot = substr( confroot, 0, length( confroot ) - 1 ) "/"; confsrc = confroot "access.default.conf"; confdst = confroot "access.conf"; print "Duplicating " confsrc " to " confdst; if ( ( getline < confdst ) < 0 ) { while ( ( getline < confsrc ) > 0 ) { print $0 > confdst; } } confsrc = confroot "httpd.default.conf"; confdst = confroot "httpd.conf"; print "Duplicating " confsrc " to " confdst; if ( ( getline < confdst ) < 0 ) { while ( ( getline < confsrc ) > 0 ) { print $0 > confdst; } } confsrc = confroot "srm.default.conf"; confdst = confroot "srm.conf"; print "Duplicating " confsrc " to " confdst; if ( ( getline < confdst ) < 0 ) { while ( ( getline < confsrc ) > 0 ) { print $0 > confdst; } } confsrc = confroot "magic.default"; confdst = confroot "magic"; print "Duplicating " confsrc " to " confdst; if ( ( getline < confdst ) < 0 ) { while ( ( getline < confsrc ) > 0 ) { print $0 > confdst; } } confsrc = confroot "mime.types.default"; confdst = confroot "mime.types"; print "Duplicating " confsrc " to " confdst; if ( ( getline < confdst ) < 0 ) { while ( ( getline < confsrc ) > 0 ) { print $0 > confdst; } } }