git-serv

All-in-one Git hosting container

git clone git://git.janzachar.dev/git-serv.git


0#!/bin/sh
1
2set -eu
3#shellcheck source=config/env
4. "/srv/config/env"
5
6id -u "$GIT_USER" 2>/dev/null || {
7	adduser -D -s /usr/bin/git-shell -u 1000 "$GIT_USER" > /dev/null
8	#adduser -D -s /bin/sh -u 1000 "$GIT_USER"
9
10	# hint: 'p' makes sed repeat each line twice 
11	sed 'p' /proc/sys/kernel/random/uuid | passwd "$GIT_USER" > /dev/null
12
13	cp -R /srv/config/git-shell-commands /home/"$GIT_USER"/git-shell-commands
14
15	chmod -R 755 /home/"$GIT_USER"/git-shell-commands
16	chown "$GIT_USER":"$GIT_USER" /log
17	chown "$GIT_USER":"$GIT_USER" /srv/pages
18}
19
20