]> git.donarmstrong.com Git - bin.git/blob - add_kgb_project
only update the main org files
[bin.git] / add_kgb_project
1 #!/bin/bash
2
3 set -e
4
5 PASSWORD=$(pwgen -s)
6
7 PROJECT=${1%%.git}
8
9 GITPATH="$(pwd)/$1"
10
11 cat << EOF > "$GITPATH/hooks/post-receive"
12 #!/bin/sh
13 kgb-client --git-reflog - --conf $GITPATH/hooks/kgb.conf
14 EOF
15
16 chmod +x "$GITPATH/hooks/post-receive"
17
18 cat << EOF > "$GITPATH/hooks/kgb.conf"
19 repo-id: $PROJECT
20 password: $PASSWORD
21 servers:
22  - uri: http://localhost:5391
23 EOF
24
25 cat << EOF |sudo tee "/etc/kgb-bot/kgb.conf.d/${PROJECT}.conf" >/dev/null
26 repositories:
27  $PROJECT:
28   password: $PASSWORD 
29 EOF
30
31 sudo chmod 640 "/etc/kgb-bot/kgb.conf.d/${PROJECT}.conf";
32 sudo chgrp Debian-kgb "/etc/kgb-bot/kgb.conf.d/${PROJECT}.conf";
33 sudo service kgb-bot reload;