]> git.donarmstrong.com Git - bin.git/commitdiff
add kgb project
authorDon Armstrong <don@donarmstrong.com>
Mon, 12 May 2014 18:01:46 +0000 (11:01 -0700)
committerDon Armstrong <don@donarmstrong.com>
Mon, 12 May 2014 18:01:46 +0000 (11:01 -0700)
add_kgb_project [new file with mode: 0755]

diff --git a/add_kgb_project b/add_kgb_project
new file mode 100755 (executable)
index 0000000..d2bccbe
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+PASSWORD=$(pwgen -s)
+
+PROJECT=${1%%.git}
+
+PATH="$(pwd)/$1"
+
+cat << EOF > "$PATH/hooks/post-receive"
+#!/bin/sh
+kgb-client --git-reflog - --conf $PATH/hooks/kgb.conf
+EOF
+
+cat << EOF > "$PATH/hooks/kgb.conf"
+repo-id: $PROJECT
+password: $PASSWORD
+servers:
+ - uri: http://localhost:5391
+EOF
+
+cat << EOF |sudo tee "/etc/kgb-bot/kgb.conf.d/$PROJECT" >/dev/null
+repositories:
+ $PROJECT:
+  password: $PASSWORD 
+EOF
+
+sudo service kgb-bot reload