Get rid of wrapper script for IkiWiki and just use make
authorTuomas Jormola <tj@solitudo.net>
Wed, 29 Jan 2014 14:46:26 +0000 (16:46 +0200)
committerTuomas Jormola <tj@solitudo.net>
Wed, 29 Jan 2014 14:49:44 +0000 (16:49 +0200)
Makefile
bin/ikiwiki.sh [deleted file]
conf/master.conf [deleted file]
conf/master.mk [new file with mode: 0644]
conf/shakti.conf [deleted file]
conf/shakti.mk [new file with mode: 0644]

index 279976e..432c7d8 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,11 +1,33 @@
+IKIWIKI_GIT_BRANCH          = $(shell git branch 2>/dev/null | awk '/^\*/ {print $$2}')
+IKIWIKI_CONFIGFILE          = $(shell echo $(IKIWIKI_GIT_BRANCH) | cut -d/ -f1)
 IKIWIKI_SETUPFILE                      = ikiwiki.setup
 REQUIRED_VARIABLES                     = IKIWIKI_HTDOCS IKIWIKI_CHECKOUTDIR IKIWIKI_STATEDIR IKIWIKI_LIBDIR IKIWIKI_URL IKIWIKI_CGIURL IKIWIKI_AUTHURL IKIWIKI_GIT_BRANCH
 IKIWIKI_TARGET_VERSION         = 3.20140125
 IKIWIKI_INSTALLED_VERSION      = $(shell perl -MIkiWiki -e'$$_=$$IkiWiki::version;s/^(\d+\.\d+).*$$/$$1/;print')
 
-define gitcommit
-       if git status $@ | grep -q modified:; then git commit -m'Re-generated $@' $@; fi
-endef
+WWW_DIR                                                ?= $(PWD)/output
+VAR_DIR                                        ?= $(WWW_DIR)/var
+IKIWIKI_CHECKOUTDIR                    ?= $(PWD)
+IKIWIKI_HTDOCS                         ?= $(WWW_DIR)/htdocs
+IKIWIKI_STATEDIR                       ?= $(VAR_DIR)/ikiwiki/statedir
+IKIWIKI_LIBDIR                         ?= $(VAR_DIR)/ikiwiki/lib
+IKIWIKI_URL                                    ?= http://localhost
+IKIWIKI_CGIURL                         ?= $(IKIWIKI_URL)/ikiwiki.cgi
+IKIWIKI_AUTHURL                                ?= $(IKIWIKI_CGIURL)/auth
+
+include conf/$(IKIWIKI_CONFIGFILE).mk
+
+export IKIWIKI_HTDOCS
+export IKIWIKI_CHECKOUTDIR
+export IKIWIKI_STATEDIR
+export IKIWIKI_LIBDIR
+export IKIWIKI_UNDERLAYDIRS
+export IKIWIKI_URL
+export IKIWIKI_CGIURL
+export IKIWIKI_AUTHURL
+export IKIWIKI_GIT_BRANCH
+export IKIWIKI_GIT_WRAPPER
+export IKIWIKI_VERBOSE
 
 all: site
 
diff --git a/bin/ikiwiki.sh b/bin/ikiwiki.sh
deleted file mode 100755 (executable)
index 8ebb9e6..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/bin/sh
-
-set -e
-
-cd `dirname $0`/..
-IKIWIKI_GIT_BRANCH=`git branch 2>/dev/null | awk '/^\*/ {print $2}'`
-if ! test -n "$IKIWIKI_GIT_BRANCH"; then
-       echo "Not a Git repository" 1>&2
-       exit 1
-fi
-conf_base=`echo $IKIWIKI_GIT_BRANCH | cut -d/ -f1`
-conf=conf/$conf_base.conf
-if ! test -f $conf; then
-       echo "No configuration for IKIWIKI_GIT_BRANCH $IKIWIKI_GIT_BRANCH" 1>&2
-       exit 1
-fi
-
-. $conf
-
-if test -z "$IKIWIKI_CHECKOUTDIR"; then
-       echo "No checkout directory" 1>&2
-fi
-
-export IKIWIKI_VERBOSE
-export IKIWIKI_CHECKOUTDIR
-export IKIWIKI_HTDOCS
-export IKIWIKI_STATEDIR
-export IKIWIKI_LIBDIR
-export IKIWIKI_UNDERLAYDIRS
-export IKIWIKI_URL
-export IKIWIKI_CGIURL
-export IKIWIKI_AUTHURL
-export IKIWIKI_GIT_BRANCH
-export IKIWIKI_GIT_WRAPPER
-
-cd $IKIWIKI_CHECKOUTDIR
-make IKIWIKI_ARGS="$*"
diff --git a/conf/master.conf b/conf/master.conf
deleted file mode 100644 (file)
index a71e82c..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-WWW_DIR=/var/local/www/solitudo.net
-VAR_DIR=$WWW_DIR/var
-IKIWIKI_CHECKOUTDIR=$VAR_DIR/ikiwiki/checkout
-IKIWIKI_HTDOCS=$WWW_DIR/htdocs
-IKIWIKI_STATEDIR=$VAR_DIR/ikiwiki/statedir
-IKIWIKI_LIBDIR=$VAR_DIR/ikiwiki/lib
-IKIWIKI_UNDERLAYDIRS="/var/local/www/solitudo.net/var/ikiwiki/private"
-IKIWIKI_URL=http://solitudo.net
-IKIWIKI_CGIURL=$IKIWIKI_URL/ikiwiki.cgi
-IKIWIKI_AUTHURL=$IKIWIKI_URL/ikiwiki.cgi/auth
-IKIWIKI_GIT_WRAPPER=$IKIWIKI_CHECKOUTDIR/.git/hooks/post-commit
diff --git a/conf/master.mk b/conf/master.mk
new file mode 100644 (file)
index 0000000..612ff58
--- /dev/null
@@ -0,0 +1,5 @@
+WWW_DIR                                        = /var/local/www/solitudo.net
+IKIWIKI_URL                            = http://solitudo.net
+IKIWIKI_CHECKOUTDIR            = $(VAR_DIR)/ikiwiki/checkout
+IKIWIKI_UNDERLAYDIRS   = $(VAR_DIR)/ikiwiki/private
+IKIWIKI_GIT_WRAPPER            = $(IKIWIKI_CHECKOUTDIR)/.git/hooks/post-commit
diff --git a/conf/shakti.conf b/conf/shakti.conf
deleted file mode 100644 (file)
index a5fa021..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-WWW_DIR=/var/local/www/shakti.solitudo.net
-VAR_DIR=$WWW_DIR/var
-IKIWIKI_VERBOSE=1
-IKIWIKI_CHECKOUTDIR=`pwd`
-IKIWIKI_HTDOCS=$WWW_DIR/htdocs/solitudo
-IKIWIKI_STATEDIR=$VAR_DIR/ikiwiki/statedir
-IKIWIKI_LIBDIR=$VAR_DIR/ikiwiki/lib
-IKIWIKI_UNDERLAYDIRS="/home/staff/tj/prj/solitudo.net-private"
-IKIWIKI_URL=http://shakti.solitudo.net/solitudo
-IKIWIKI_CGIURL=$IKIWIKI_URL/ikiwiki.cgi
-IKIWIKI_AUTHURL=/solitudo/ikiwiki.cgi/auth
diff --git a/conf/shakti.mk b/conf/shakti.mk
new file mode 100644 (file)
index 0000000..af45393
--- /dev/null
@@ -0,0 +1,5 @@
+WWW_DIR                                        = /var/local/www/shakti.solitudo.net
+IKIWIKI_URL                            = http://shakti.solitudo.net/solitudo
+IKIWIKI_HTDOCS                 = $(WWW_DIR)/htdocs/solitudo
+IKIWIKI_UNDERLAYDIRS   = /home/staff/tj/prj/solitudo.net-private
+IKIWIKI_VERBOSE                        = 1