--- ./nb.orig	2010-02-15 22:01:53.000000000 +0100
+++ ./nb	2010-03-01 22:12:55.000000000 +0100
@@ -1,4 +1,4 @@
-#! /bin/bash
+#! %%LOCALBASE%%/bin/bash
 ############################################################
 #  NanoBlogger 3.4.2 Copyright 2010 n1xt3r (Kevin R. Wood) #
 ############################################################
@@ -11,11 +11,11 @@
 
 # -- hardcoded paths --
 # where to expect nanoblogger's base
-NB_BASE_DIR=`dirname $0`
+NB_BASE_DIR="%%DATADIR%%"
 # where to expect nanoblogger's documentation
-NB_DOC_DIR="$NB_BASE_DIR/docs"
+NB_DOC_DIR="%%DOCSDIR%%"
 # where to expect nanoblogger's conf file
-NB_CFG_DIR="$NB_BASE_DIR"
+NB_CFG_DIR="%%PREFIX%%/etc"
 # nanoblogger's language definitions directory.
 NB_LANG_DIR="${NB_BASE_DIR}/lang"
 # nanoblogger's module directory.
@@ -875,6 +875,9 @@
 			for weblog_dir in "$NB_BASE_DIR"/default/*; do
 				cp -R "$weblog_dir" "$BLOG_DIR"
 			done
+			# set writable mode for default files
+			find "$BLOG_DIR" -type d -print0 | xargs -0 chmod 755
+			find "$BLOG_DIR" -type f -print0 | xargs -0 chmod 644
 			# create some critical empty directories
 			for weblog_emptydir in "$ARCHIVES_DIR" "$CACHE_DIR" "$PARTS_DIR"; do
 				[ ! -d "$BLOG_DIR/$weblog_emptydir" ] && mkdir "$BLOG_DIR/$weblog_emptydir"
