#!/bin/sh
set -eu

GITMF_SHARE_DIR='/usr/share/git-metafile'

verbose_opt='-v'
quiet_opt=''
case "${1:-}" in
	-h | --help) echo "Usage: $0 [-h | --help] [-q] [ETC_DIR]"; exit 0;;
	-q | --quiet) verbose_opt=''; quiet_opt='-q'; shift;;
esac

cd "${1:-/etc}"

git init $quiet_opt
ln -fs $verbose_opt "$GITMF_SHARE_DIR"/hooks/* .git/hooks/
cp $verbose_opt "$GITMF_SHARE_DIR"/gitignore .gitignore
