-
Notifications
You must be signed in to change notification settings - Fork 1
/
install
executable file
·34 lines (26 loc) · 996 Bytes
/
install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#! /bin/bash
dir=$(realpath "$0" | sed 's/\/[^/]*$//')
ln -fs $dir/git.post-receive.install-services /usr/local/bin/
hook=/usr/bin/git.post-receive.install-services
mkdir -p /srv
git config --global receive.denyCurrentBranch ignore # so we can push to a working repo
template_dir=/usr/share/prts/repo-template.git
existing_template_dir=$(git config --global init.templatedir)
if [[ -z $existing_template_dir ]]; then
echo "Git does not have an init.templatedir, setting $template_dir."
git config --global init.templatedir $template_dir
else
if [[ "$curr_templatedir" == "$templatedir" ]]; then
exit
fi
if [[ ! -e $curr_templatedir/hooks/post-receive ]]; then
mkdir -p $curr_templatedir/hooks/
cp $templatedir/hooks/post-receive $curr_templatedir/hooks/
else
echo "" >> $curr_templatedir/hooks/post-receive
echo "$hook" >> $curr_templatedir/hooks/post-receive
fi
fi
echo
echo "Don't forget to put your public ssh key is in /home/git/.ssh/authorized_keys!"
echo