summaryrefslogtreecommitdiff
path: root/bins/trove-early-setup
blob: 18b34d4d81a480eb29cbf41d1cfd6a4a37d70085 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/make -f
# -*- Make -*-

all: users

users: /home/git/.created /home/lorry/.created /home/cache/.created

/home/%/.created: hostname-set
	TROVE_USER=$(patsubst /home/%/.created,%,$@); \
	adduser -g "Trove $$TROVE_USER service" -s /bin/bash -D $$TROVE_USER && \
	echo -e'insecure\ninsecure' | passwd $$TROVE_USER && \
	su -c 'mkdir .ssh; chmod 750 .ssh' - $$TROVE_USER && \
	su -c 'ssh-keygen -t rsa -N "" -q -f .ssh/id_rsa' - $$TROVE_USER && \
        (cat /etc/ssh/ssh_host_*_key.pub | cut -d\  -f1,2 | \
	 sed -e's/^/'$$(hostname)',localhost /' > \
	 /home/$$TROVE_USER/.ssh/known_hosts) && \
        chown $$TROVE_USER:$$TROVE_USER /home/$$TROVE_USER/.ssh/known_hosts && \
        chmod 600 /home/$$TROVE_USER/.ssh/known_hosts
	touch $@