summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <daniel.silverstone@codethink.co.uk>2012-09-13 15:07:16 +0100
committerDaniel Silverstone <daniel.silverstone@codethink.co.uk>2012-09-13 15:07:16 +0100
commit2d30137e0064eb734178fed0a93fc12fe3413dd9 (patch)
tree25cb263e2a21ae05776aba0c574b6be36fdbb1b5
parent751bbec586f9abad014a94076a2f21b71ed3cfb8 (diff)
downloadtrove-setup-2d30137e0064eb734178fed0a93fc12fe3413dd9.tar.gz
Early setup and bins
-rw-r--r--Makefile2
-rwxr-xr-xbins/trove-early-setup19
2 files changed, 21 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 8afdb6b..1c0671d 100644
--- a/Makefile
+++ b/Makefile
@@ -14,3 +14,5 @@ install:
cp http-assets/* "${DESTDIR}/var/www/htdocs"
ln -s cgit "${DESTDIR}/var/www/htdocs/cgi-bin"
ln -s /home/lorry/bundles "${DESTDIR}/var/www/htdocs/bundles"
+ mkdir -p "${DESTDIR}/usr/bin"
+ cp bins/* "${DESTDIR}/usr/bin/"
diff --git a/bins/trove-early-setup b/bins/trove-early-setup
new file mode 100755
index 0000000..18b34d4
--- /dev/null
+++ b/bins/trove-early-setup
@@ -0,0 +1,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 $@ \ No newline at end of file