Index: /trunk/Makefile
===================================================================
--- /trunk/Makefile	(revision 127)
+++ /trunk/Makefile	(revision 128)
@@ -11,11 +11,14 @@
 .PHONY: all format clean ./Server ./Common ./Module ./Manpage get-version
 
-all: ./Server ./Module ./Manpage
+all: ./Server ./Module ./Manpage ./Tool/genconf ./Tool/itworks
 
-./Server/option: ./Server/option.c
-	cc -o $@ ./Server/option.c
+./Tool/option: ./Tool/option.c
+	cc -o $@ ./Tool/option.c
 
-./Server:: ./Common ./Server/option
-	$(MAKE) -C $@ $(FLAGS) EXTOBJS="`./Server/option objs ../`" EXTLIBS="`./Server/option libs ../`" EXTCFLAGS="`./Server/option cflags ../`" EXTLDFLAGS="`./Server/option ldflags ../`"
+./Tool/genconf: ./Tool/genconf.c
+	cc -o $@ ./Tool/genconf.c
+
+./Server:: ./Common ./Tool/option
+	$(MAKE) -C $@ $(FLAGS) EXTOBJS="`./Tool/option objs ../`" EXTLIBS="`./Tool/option libs ../`" EXTCFLAGS="`./Tool/option cflags ../`" EXTLDFLAGS="`./Tool/option ldflags ../`"
 
 ./Module:: ./Common
@@ -28,7 +31,9 @@
 	$(MAKE) -C $@ $(FLAGS)
 
-install: all
-	mkdir -p $(PREFIX)/bin $(PREFIX)/lib/tewi $(PREFIX)/share/man/man5 $(PREFIX)/etc
-	if [ ! -e $(PREFIX)/etc/tewi.conf ]; then cp example.conf $(PREFIX)/etc/tewi.conf ; fi
+install: all ./Tool/genconf ./Tool/itworks
+	mkdir -p $(PREFIX)/bin $(PREFIX)/lib/tewi $(PREFIX)/share/man/man5 $(PREFIX)/etc $(PREFIX)/www
+	if [ ! -e $(PREFIX)/etc/tewi.conf ]; then ( ./Tool/genconf $(PREFIX) > $(PREFIX)/etc/tewi.conf || ( rm $(PREFIX)/etc/tewi.conf ; exit 1 ) ) ; fi
+	if [ ! -e $(PREFIX)/www/index.html ]; then ( ./Tool/itworks > $(PREFIX)/www/index.html || ( rm $(PREFIX)/www/index.html ; exit 1 ) ) ; fi
+	if [ ! -e $(PREFIX)/www/pbtewi.gif ]; then ( cp Binary/pbtewi.gif $(PREFIX)/www/ || ( rm $(PREFIX)/www/pbtewi.gif ; exit 1 ) ) ; fi
 	cp ./Server/tewi $(PREFIX)/bin/
 	cp ./Module/*.so $(PREFIX)/lib/tewi/
@@ -46,3 +51,3 @@
 	$(MAKE) -C ./Common $(FLAGS) clean
 	$(MAKE) -C ./Manpage $(FLAGS) clean
-	rm -f ./Server/option
+	rm -f ./Tool/option ./Tool/genconf
Index: /trunk/Server/Makefile
===================================================================
--- /trunk/Server/Makefile	(revision 127)
+++ /trunk/Server/Makefile	(revision 128)
@@ -16,5 +16,5 @@
 	$(CC) $(CFLAGS) $(EXTCFLAGS) -c -o $@ $<
 
-tewi.res: tewi.rc tewi.ico
+tewi.res: tewi.rc ../Binary/tewi.ico
 	$(WINDRES) tewi.rc -O coff -o $@
 
Index: /trunk/Server/config.c
===================================================================
--- /trunk/Server/config.c	(revision 127)
+++ /trunk/Server/config.c	(revision 128)
@@ -90,5 +90,7 @@
 	config.extension = NULL;
 	config.server_root = cm_strdup(PREFIX);
+	config.server_admin = cm_strdup(SERVER_ADMIN);
 	gethostname(config.hostname, 1024);
+	chdir(config.server_root);
 }
 
@@ -247,4 +249,12 @@
 							free(config.server_root);
 							config.server_root = cm_strdup(r[1]);
+						}
+					} else if(cm_strcaseequ(r[0], "ServerAdmin")) {
+						if(r[1] == NULL) {
+							cm_log("Config", "Missing email at line %d", ln);
+							stop = 1;
+						} else {
+							free(config.server_admin);
+							config.server_admin = cm_strdup(r[1]);
 						}
 					} else if(cm_strcaseequ(r[0], "DocumentRoot")) {
Index: /trunk/Server/install.nsi
===================================================================
--- /trunk/Server/install.nsi	(revision 127)
+++ /trunk/Server/install.nsi	(revision 128)
@@ -13,5 +13,5 @@
 OutFile "install.exe"
 InstallDir "C:\Tewi"
-Icon "tewi-install.ico"
+Icon "../Binary/tewi-install.ico"
 LicenseData ../LICENSE
 
@@ -43,7 +43,8 @@
 	SetOutPath "$INSTDIR\etc"
 	SetOverWrite off
-	File /oname=tewi.conf "../example-win.conf"
+	File /oname=tewi.conf "../generated.conf"
 	SetOutPath "$INSTDIR\www"
 	File /oname=index.html "../itworks.html"
+	File /oname=pbtewi.gif "../Binary/pbtewi.gif"
 	SetOutPath "$INSTDIR\www\icons"
 	File "../Icons/*.png"
Index: unk/Server/option.c
===================================================================
--- /trunk/Server/option.c	(revision 127)
+++ 	(revision )
@@ -1,31 +1,0 @@
-/* $Id$ */
-/* This file is not intended to be in the server. */
-
-#include <stdio.h>
-#include <string.h>
-
-#include "../config.h"
-
-int main(int argc, char** argv) {
-	if(argc < 3) {
-		return 1;
-	}
-	if(strcmp(argv[1], "cflags") == 0) {
-#ifndef NO_SSL
-		printf("-I %s/openssl/include", argv[2]);
-#endif
-	} else if(strcmp(argv[1], "ldflags") == 0) {
-#ifndef NO_SSL
-		printf("-L %s/openssl/lib", argv[2]);
-#endif
-	} else if(strcmp(argv[1], "objs") == 0) {
-#ifndef NO_SSL
-		printf("ssl.o");
-#endif
-	} else if(strcmp(argv[1], "libs") == 0) {
-#ifndef NO_SSL
-		printf("-lssl -lcrypto");
-#endif
-	}
-	printf("\n");
-}
Index: /trunk/Server/tewi.rc
===================================================================
--- /trunk/Server/tewi.rc	(revision 127)
+++ /trunk/Server/tewi.rc	(revision 128)
@@ -3,5 +3,5 @@
 #include "../config.h"
 
-id ICON "./tewi.ico"
+id ICON "../Binary/tewi.ico"
 VS_VERSION_INFO VERSIONINFO
 	FILEVERSION 1,0,0,0
Index: /trunk/Server/tw_config.h
===================================================================
--- /trunk/Server/tw_config.h	(revision 127)
+++ /trunk/Server/tw_config.h	(revision 128)
@@ -82,4 +82,5 @@
 	int module_count;
 	int vhost_count;
+	char* server_admin;
 	char* server_root;
 	char* extension;
Index: /trunk/Server/tw_version.h
===================================================================
--- /trunk/Server/tw_version.h	(revision 127)
+++ /trunk/Server/tw_version.h	(revision 128)
@@ -4,5 +4,5 @@
 #define __TW_VERSION_H__
 
-#define TW_VERSION "1.03A\0"
+#define TW_VERSION "1.04\0"
 
 const char* tw_get_version(void);
Index: /trunk/Tool/genconf.c
===================================================================
--- /trunk/Tool/genconf.c	(revision 128)
+++ /trunk/Tool/genconf.c	(revision 128)
@@ -0,0 +1,49 @@
+/* $Id$ */
+
+#include "../config.h"
+
+#include <stdio.h>
+
+int main(int argc, char** argv){
+	if(argc < 2){
+		return 1;
+	}
+	printf("##\n");
+	printf("## tewi.conf -- Tewi HTTPd configuration file\n");
+	printf("##\n");
+	printf("\n");
+	printf("# This configuration file is auto-generated.\n");
+	printf("\n");
+	printf("ServerRoot %s\n", argv[1]);
+	printf("\n");
+	printf("ServerAdmin %s\n", SERVER_ADMIN);
+	printf("\n");
+	printf("LoadModule lib/tewi/mod_cgi.so\n");
+	printf("#LoadModule lib/tewi/mod_proxy.so\n");
+	printf("\n");
+	printf("Listen 80\n");
+	printf("#ListenSSL 443\n");
+	printf("\n");
+	printf("#SSLKey key.pem\n");
+	printf("#SSLCertificate cert.pem\n");
+	printf("\n");
+	printf("MIMEType all application/octet-stream\n");
+	printf("MIMEType .html text/html\n");
+	printf("MIMEType .txt text/plain\n");
+	printf("MIMEType .png image/png\n");
+	printf("\n");
+	printf("Icon all /icons/unknown.png\n");
+	printf("Icon text/* /icons/text.png\n");
+	printf("Icon image/* /icons/image.png\n");
+	printf("Icon misc/dir /icons/folder.png\n");
+	printf("Icon misc/parent /icons/parent.png\n");
+	printf("DirectoryIndex index.html\n");
+	printf("\n");
+	printf("Readme README\n");
+	printf("\n");
+	printf("DocumentRoot %s/www\n", argv[1]);
+	printf("\n");
+	printf("BeginDirectory %s/www\n", argv[1]);
+	printf("\tAllow all\n");
+	printf("EndDirectory\n", argv[1]);
+}
Index: /trunk/Tool/option.c
===================================================================
--- /trunk/Tool/option.c	(revision 128)
+++ /trunk/Tool/option.c	(revision 128)
@@ -0,0 +1,31 @@
+/* $Id$ */
+/* This file is not intended to be in the server. */
+
+#include <stdio.h>
+#include <string.h>
+
+#include "../config.h"
+
+int main(int argc, char** argv) {
+	if(argc < 3) {
+		return 1;
+	}
+	if(strcmp(argv[1], "cflags") == 0) {
+#ifndef NO_SSL
+		printf("-I %s/openssl/include", argv[2]);
+#endif
+	} else if(strcmp(argv[1], "ldflags") == 0) {
+#ifndef NO_SSL
+		printf("-L %s/openssl/lib", argv[2]);
+#endif
+	} else if(strcmp(argv[1], "objs") == 0) {
+#ifndef NO_SSL
+		printf("ssl.o");
+#endif
+	} else if(strcmp(argv[1], "libs") == 0) {
+#ifndef NO_SSL
+		printf("-lssl -lcrypto");
+#endif
+	}
+	printf("\n");
+}
Index: /trunk/config.h.tmpl
===================================================================
--- /trunk/config.h.tmpl	(revision 127)
+++ /trunk/config.h.tmpl	(revision 128)
@@ -3,4 +3,6 @@
 #ifndef __CONFIG_H__
 #define __CONFIG_H__
+
+#define SERVER_ADMIN "webmaster@domain"
 
 #undef NO_SSL
Index: unk/example-win.conf
===================================================================
--- /trunk/example-win.conf	(revision 127)
+++ 	(revision )
@@ -1,31 +1,0 @@
-# $Id$
-# This is an example config
-
-ServerRoot C:/Tewi
-
-Listen 80
-#ListenSSL 443
-
-#SSLKey key.pem
-#SSLCertificate cert.pem
-
-MIMEType all application/octet-stream
-MIMEType .html text/html
-MIMEType .txt text/plain
-MIMEType .png image/png
-
-Icon all /icons/unknown.png
-Icon text/* /icons/text.png
-Icon image/* /icons/image.png
-Icon misc/dir /icons/folder.png
-Icon misc/parent /icons/parent.png
-
-DirectoryIndex index.html
-
-Readme README
-
-DocumentRoot C:/Tewi/www
-
-BeginDirectory C:/Tewi/www
-	Allow all
-EndDirectory
Index: /trunk/installer.sh
===================================================================
--- /trunk/installer.sh	(revision 127)
+++ /trunk/installer.sh	(revision 128)
@@ -5,4 +5,6 @@
 	rm -f tewi-service.exe
 	rm -f tewi.exe
+	rm -f generated.conf
+	rm -f itworks.html
 	mv config.h.bak config.h
 	exit 1
@@ -22,4 +24,6 @@
 cp Server/tewi.exe tewi-service.exe
 cd Server
+../Tool/genconf > ../generated.conf
+../Tool/itworks > ../itworks.html
 makensis -DVERSION=$VERSION install.nsi
 cp install.exe ../install-nossl.exe
@@ -36,6 +40,11 @@
 cp Server/tewi.exe tewi-service.exe
 cd Server
+../Tool/genconf > ../generated.conf
+../Tool/itworks > ../itworks.html
 makensis -DVERSION=$VERSION install.nsi
 cp install.exe ../install-ssl.exe
 rm -f tewi.exe tewi-service.exe
 cd ..
+
+rm itworks.html
+rm generated.conf
Index: unk/itworks.html
===================================================================
--- /trunk/itworks.html	(revision 127)
+++ 	(revision )
@@ -1,11 +1,0 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
-<html>
-	<head>
-		<title>It Works</title>
-	</head>
-	<body>
-		<h1>It Works!</h1>
-		<hr>
-		Congratulations - If you can see this page, it means Tewi HTTPd has been configured successfully!
-	</body>
-</html>
