flock_multi: narrow down exceptions reported as error conditions
[puppet-git.git] / ppg-init-goldsvr
blob522e6810ac19081a71468c2ed6bb1016c64dd56f
1 #!/bin/bash
3 if [[ -n "${PPG_DEBUG}" ]]; then
4 set -x
5 fi
7 if [[ -z "$1" ]]; then
8 echo >&2 "ERROR: needs base path parameter"
9 exit 1
12 base_repo=$1
14 mkdir -p $1
15 echo "Preparing the repository for your Puppet configurations"
16 git --git-dir=${base_repo}/puppet.git init --bare
18 echo "Preparing the repository for reports"
19 git --git-dir=${base_repo}/reports.git init --bare
20 # this repo will never get a normal HEAD comit
21 # so prep empty commit
22 export GIT_INDEX_FILE=/tmp/ppg-emptytree.$$
23 export GIT_DIR=${base_repo}/reports.git
24 empty_tree="$(git write-tree)"
25 rm ${GIT_INDEX_FILE}
26 unset GIT_INDEX_FILE
27 empty_commit=$(echo empty | git commit-tree ${empty_tree})
28 git update-ref refs/tags/ppg-emptycommit ${empty_commit}
29 git symbolic-ref HEAD refs/tags/ppg-emptycommit
30 echo
31 echo "Make reports.git writable by the user/group that clients"
32 echo "use to connect."