From 27d338dec0428bc22e2838eb8641c6e0d1681e22 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Fri, 10 May 2013 20:46:04 +0200 Subject: Include mk* scripts --- mkgit | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100755 mkgit (limited to 'mkgit') diff --git a/mkgit b/mkgit new file mode 100755 index 0000000..99449a6 --- /dev/null +++ b/mkgit @@ -0,0 +1,43 @@ +#!/bin/sh + +# create local git, and create and push to remote git + +set -e + +login=debian@source.jones.dk +path="/srv/git/source.jones.dk/epfsug/diff" + +# resolve options +eval set -- "$(getopt -s sh -o f -- "$@")" +while true; do case "$1" in -f) force=-f; shift;; --) shift; break;; esac; done + +. /lib/lsb/init-functions + +# add suffix unless already included +gitpath="$(dirname "$path")/$(basename "$path" .git).git" + +log_action_begin_msg "Publish git" + +# initialize local git +log_action_cont_msg "init" +if [ -d .git ]; then + if [ -n "$force" ]; then + log_warning_msg "purging" + rm -rf .git + else + log_failure_msg "local git already exist (force with -f)" + exit 1 + fi +fi +git init + +# add scripts +log_action_cont_msg "add" +git add mk*; git commit -m "Include mk* scripts" + +# create and populate remote git +log_action_cont_msg "push" +ssh "$login" git init --bare "$gitpath" \&\& cd "$gitpath" \&\& mv hooks/post-update{.sample,} \&\& touch git-daemon-export-ok +git push $force --all -u "$login:$gitpath" || { log_failure_msg "remote git already exist (force with -f)"; exit 1; } + +log_action_end_msg $? -- cgit v1.2.3