#!/bin/sh
set -e

description="$(hostname 2>/dev/null || cat /etc/hostname) ${ETCKEEPER_DIR} repository"
if [ "$VCS" = git ] && [ ! -e .git ]; then
	git init
	echo "$description" > .git/description
elif [ "$VCS" = hg ] && [ ! -e .hg ]; then
	hg init
	echo  "[web]" > .hg/hgrc
	echo  "description = $description" >> .hg/hgrc
elif [ "$VCS" = bzr ] && [ ! -e .bzr ]; then
	bzr init
	bzr nick "$description"
elif [ "$VCS" = darcs ] && [ ! -e _darcs ]; then
	darcs initialize
	echo "$description" > _darcs/prefs/motd
fi
