Permalink
Browse files

Preserve existing configuration files during installation.

This is achieved by renaming any existing configuration files as a pre-install step.
As a post-install step and renamed files are then moved back to their original position (overwriting the config files that came with the installer).
  • Loading branch information...
svniemeijer committed Apr 9, 2013
1 parent e71f1ff commit 2b1640622f05ba67fb4c984e05a19fe9d59ac2bb
@@ -1,8 +1,6 @@
Installation of the Hiawatha webserver
=======================================
-If you've already installed the Hiawatha webserver on this machine, make a backup of the files in /usr/local/etc/hiawatha or /etc/hiawatha.
-
Double-click the .pkg file to start the installation and follow the instructions on the screen. This will install Hiawatha in /usr/local. The configuration files can be found in /usr/local/etc/hiawatha.
Open a Terminal and execute 'sudo /usr/local/sbin/hiawatha' to start the Hiawatha webserver.
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+cd /usr/local/etc/hiawatha
+
+files="cgi-wrapper.conf hiawatha.conf index.xslt mimetype.conf"
+
+for file in $files ; do
+ if [ -f $file.installer.backup ]; then
+ mv $file.installer.backup $file
+ fi
+done
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+cd /usr/local/etc/hiawatha
+
+files="cgi-wrapper.conf hiawatha.conf index.xslt mimetype.conf"
+
+for file in $files ; do
+ if [ -f $file ]; then
+ mv $file $file.installer.backup
+ fi
+done
@@ -55,7 +55,7 @@ cp ../extra/macosx/org.hiawatha-webserver.httpd.plist root/Library/LaunchDaemons
echo "-- Building package"
cp -r ../extra/macosx/diskimage .
version=`grep VERSION config.h | cut -f2 -d'"'`
-pkgbuild --root root --version ${version} --identifier org.hiawatha-webserver.httpd hiawatha.pkg
+pkgbuild --root root --scripts ../extra/macosx/scripts --version ${version} --identifier org.hiawatha-webserver.httpd hiawatha.pkg
productbuild --distribution ../extra/macosx/Distribution.xml --resources ../extra/macosx diskimage/hiawatha-${version}.pkg
echo "-- Buiding disk image"
hdiutil create ../"Hiawatha ${version}".dmg -srcfolder diskimage -volname "Hiawatha ${version}" -ov

0 comments on commit 2b16406

Please sign in to comment.