summaryrefslogtreecommitdiff
path: root/Makefile
blob: a1a7bef4f1af13ab8dcce0ca29eb3d39dc47fbe9 (plain)
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
# The git user home, from where repos are served
PREFIX=/srv/git
# The git user
USER=git
# The git-shell path
GIT_SHELL=/usr/bin/git-shell
# The hacking.git clone
HACKERS=$(PWD)

# Create the user
user: 
	useradd --home $(PREFIX) \
            --shell $(GIT_SHELL) \
            --create-home \
            --system \
            --user-group \
            $(USER)

# Create the hackers.git bare repo and clone as .ssh 
# Then create needed symlinks and add hooks to hackers.git
install: 
	cd $(PREFIX); \
	git clone --bare $(HACKERS) hackers.git && \
	git clone hackers.git .ssh && \
	chmod 700 $(PREFIX) && \
	chmod 700 .ssh && \
	chmod 600 .ssh/authorized_keys && \
	ln -s $(PREFIX)/.ssh/git-hooks/* hackers.git/hooks/ && \
	ln -s $(PREFIX)/.ssh/git-shell-commands && \
    chown -R $(USER):$(USER) $(PREFIX)