installwinconf.awk revision 6ad55f63504cf5fe5205ed9495664519afeadcd9
50cfe8bbbaf4279375802531268e2bf0155215fetrawick# InstallConf.awk Apache HTTP 2.2 script to rewrite the @@ServerRoot@@
50cfe8bbbaf4279375802531268e2bf0155215fetrawick# tags in httpd.conf.in to original\httpd.conf - then duplicate the
50cfe8bbbaf4279375802531268e2bf0155215fetrawick# conf files to the 'live' configuration if they don't already exist.
50cfe8bbbaf4279375802531268e2bf0155215fetrawick# Note that we -don't- want the ARGV file list, so no additional {} blocks
50cfe8bbbaf4279375802531268e2bf0155215fetrawick# are coded. Use explicit args (more reliable on Win32) and use the fact
50cfe8bbbaf4279375802531268e2bf0155215fetrawick# that ARGV[] params are -not- '\' escaped to process the C:\Foo\Bar Win32
50cfe8bbbaf4279375802531268e2bf0155215fetrawick# path format. Note that awk var=path would not succeed, since it -does-
50cfe8bbbaf4279375802531268e2bf0155215fetrawick# escape backslashes in the assignment. Note also, a trailing space is
50cfe8bbbaf4279375802531268e2bf0155215fetrawick# required for paths, or the trailing quote following the backslash is
50cfe8bbbaf4279375802531268e2bf0155215fetrawick# escaped, rather than parsed.
bbb64779da3514ea1fee8b806f5ad30d29ea45abtrawick print "Installing Apache HTTP 2.0 server with" >tstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick filelist["httpd-autoindex.conf"] = "httpd-autoindex.conf.in";
50cfe8bbbaf4279375802531268e2bf0155215fetrawick filelist["httpd-default.conf"] = "httpd-default.conf.in";
50cfe8bbbaf4279375802531268e2bf0155215fetrawick filelist["httpd-languages.conf"] = "httpd-languages.conf.in";
50cfe8bbbaf4279375802531268e2bf0155215fetrawick filelist["httpd-manual.conf"] = "httpd-manual.conf.in";
50cfe8bbbaf4279375802531268e2bf0155215fetrawick filelist["httpd-multilang-errordoc.conf"] = "httpd-multilang-errordoc.conf.in";
50cfe8bbbaf4279375802531268e2bf0155215fetrawick filelist["httpd-userdir.conf"] = "httpd-userdir.conf.in";
50cfe8bbbaf4279375802531268e2bf0155215fetrawick filelist["httpd-vhosts.conf"] = "httpd-vhosts.conf.in";
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "# NOTE: Where filenames are specified, you must use forward slashes" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "# instead of backslashes (e.g., \"c:/apache\" instead of \"c:\\apache\")." > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "# If a drive letter is omitted, the drive on which httpd.exe is located" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "# will be used by default. It is recommended that you always supply" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "# an explicit drive letter in absolute paths to avoid confusion." > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "LoadModule access_compat_module modules/mod_access_compat.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "LoadModule actions_module modules/mod_actions.so" > dstfl;
7a42584e6f09102c6776454f090b98a58fd590ebtrawick print "LoadModule alias_module modules/mod_alias.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "LoadModule asis_module modules/mod_asis.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "LoadModule auth_basic_module modules/mod_auth_basic.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "#LoadModule auth_digest_module modules/mod_auth_digest.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "#LoadModule authn_anon_module modules/mod_authn_anon.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "LoadModule authn_core_module modules/mod_authn_core.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "#LoadModule authn_dbd_module modules/mod_authn_dbd.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "#LoadModule authn_dbm_module modules/mod_authn_dbm.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "LoadModule authn_file_module modules/mod_authn_file.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "#LoadModule authnz_ldap_module modules/mod_authnz_ldap.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "LoadModule authz_core_module modules/mod_authz_core.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "#LoadModule authz_dbd_module modules/mod_authz_dbd.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "#LoadModule authz_dbm_module modules/mod_authz_dbm.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "LoadModule authz_groupfile_module modules/mod_authz_groupfile.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "LoadModule authz_host_module modules/mod_authz_host.so" > dstfl;
7a42584e6f09102c6776454f090b98a58fd590ebtrawick print "#LoadModule authz_owner_module modules/mod_authz_owner.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "LoadModule authz_user_module modules/mod_authz_user.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "LoadModule autoindex_module modules/mod_autoindex.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "#LoadModule cache_module modules/mod_cache.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "#LoadModule cern_meta_module modules/mod_cern_meta.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "LoadModule cgi_module modules/mod_cgi.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "#LoadModule charset_lite_module modules/mod_charset_lite.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "#LoadModule dav_module modules/mod_dav.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "#LoadModule dav_fs_module modules/mod_dav_fs.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "#LoadModule dav_lock_module modules/mod_dav_lock.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "#LoadModule dbd_module modules/mod_dbd.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "#LoadModule deflate_module modules/mod_deflate.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "LoadModule dir_module modules/mod_dir.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "#LoadModule disk_cache_module modules/mod_disk_cache.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "#LoadModule dumpio_module modules/mod_dumpio.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "LoadModule env_module modules/mod_env.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "#LoadModule expires_module modules/mod_expires.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "#LoadModule ext_filter_module modules/mod_ext_filter.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "#LoadModule file_cache_module modules/mod_file_cache.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "#LoadModule filter_module modules/mod_filter.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "#LoadModule headers_module modules/mod_headers.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "#LoadModule ident_module modules/mod_ident.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "#LoadModule imagemap_module modules/mod_imagemap.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "LoadModule include_module modules/mod_include.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "#LoadModule info_module modules/mod_info.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "LoadModule isapi_module modules/mod_isapi.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "#LoadModule ldap_module modules/mod_ldap.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "#LoadModule logio_module modules/mod_logio.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "LoadModule log_config_module modules/mod_log_config.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "#LoadModule log_forensic_module modules/mod_log_forensic.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "#LoadModule mem_cache_module modules/mod_mem_cache.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "LoadModule mime_module modules/mod_mime.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "#LoadModule mime_magic_module modules/mod_mime_magic.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "LoadModule negotiation_module modules/mod_negotiation.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "#LoadModule proxy_module modules/mod_proxy.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "#LoadModule proxy_ajp_module modules/mod_proxy_ajp.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "#LoadModule proxy_balancer_module modules/mod_proxy_balancer.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "#LoadModule proxy_connect_module modules/mod_proxy_connect.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "#LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "#LoadModule proxy_http_module modules/mod_proxy_http.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "#LoadModule rewrite_module modules/mod_rewrite.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "LoadModule setenvif_module modules/mod_setenvif.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "#LoadModule speling_module modules/mod_speling.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "#LoadModule ssl_module modules/mod_ssl.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "#LoadModule status_module modules/mod_status.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "#LoadModule substitute_module modules/mod_substitute.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "#LoadModule unique_id_module modules/mod_unique_id.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "#LoadModule userdir_module modules/mod_userdir.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "#LoadModule usertrack_module modules/mod_usertrack.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "#LoadModule version_module modules/mod_version.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "#LoadModule vhost_alias_module modules/mod_vhost_alias.so" > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick if ( gsub( /@exp_logfiledir@/, serverroot "/logs" ) ||
50cfe8bbbaf4279375802531268e2bf0155215fetrawick gsub( /\/home\/\*\/public_html/, \
50cfe8bbbaf4279375802531268e2bf0155215fetrawick gsub( /UserDir public_html/, "UserDir \"My Documents/My Website\"" );
2e3867b767f5f34e6ab6414670f3306806913810trawick gsub( /@@ServerName@@|www.example.com/, servername );
2e3867b767f5f34e6ab6414670f3306806913810trawick gsub( /@@ServerAdmin@@|you@example.com/, serveradmin );
50cfe8bbbaf4279375802531268e2bf0155215fetrawick gsub( /@@DomainName@@|example.com/, domainname );
50cfe8bbbaf4279375802531268e2bf0155215fetrawick gsub( /@@Port@@/, serverport );
2e3867b767f5f34e6ab6414670f3306806913810trawick gsub( /@@SSLPort@@|443/, serversslport );
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print $0 > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick close(srcfl);
50cfe8bbbaf4279375802531268e2bf0155215fetrawick if ( close(dstfl) >= 0 ) {
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print "Failed to rewrite " srcfl "\n to " dstfl > tstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick for ( conffile in filelist ) {
50cfe8bbbaf4279375802531268e2bf0155215fetrawick srcfl = confdefault filelist[conffile] conffile;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick dstfl = confroot filelist[conffile] conffile;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick if ( ( getline < dstfl ) < 0 ) {
50cfe8bbbaf4279375802531268e2bf0155215fetrawick while ( ( getline < srcfl ) > 0 ) {
50cfe8bbbaf4279375802531268e2bf0155215fetrawick print $0 > dstfl;
50cfe8bbbaf4279375802531268e2bf0155215fetrawick close(srcfl);
50cfe8bbbaf4279375802531268e2bf0155215fetrawick close(dstfl);
50cfe8bbbaf4279375802531268e2bf0155215fetrawick close(tstfl);