#!/bin/sh replace_string() { sed "s//$2/" } fugitive_write_template() { name=`git config --get user.name` base64 -d | gunzip | replace_string "name" "$name" | \ replace_string "year" "`date +%Y`" } fugitive_install_hooks() { echo -n "Installing fugitive hooks scripts... " (base64 -d | gunzip) > .git/hooks/post-commit < .git/hooks/post-receive </dev/null echo "done." echo -n "Creating default directory tree... " mkdir -p _drafts _articles _templates _public echo "done." echo -n "Adding default settings to git config... " git config --add fugitive.blog-url "http://localhost/fugitive/" git config --add --path fugitive.templates-dir "_templates" git config --add --path fugitive.articles-dir "_articles" git config --add --path fugitive.public-dir "_public" git config --add fugitive.preproc "" echo "done." echo -n "Writing default template files... " fugitive_write_template > _templates/article.html < _templates/archives.html < _templates/top.html < _templates/bottom.html < _templates/feed.xml < fugitive.css < print.css </dev/null git commit -m "fugitive inital import" >/dev/null echo "done." echo -n "Preventing git to track temporary and generated files... " echo "*~\nindex.html\narchives.html" > .git/info/exclude echo "done." echo "Writing dummy article (README) and adding it to the repos... " (base64 -d | gunzip) > _articles/README </dev/null echo "done." cd - >/dev/null echo 'Installation almost complete, please visit your blog :-).' } case "$1" in "--help") fugitive_help >&2;; "--install") fugitive_install "$2";; "--install-hooks") fugitive_install_hooks "$2";; *) fugitive_usage >&2;; esac