summaryrefslogtreecommitdiff
path: root/firehose.configure
diff options
context:
space:
mode:
authorLauren Perry <lauren.perry@codethink.co.uk>2015-01-09 16:43:40 +0000
committerLauren Perry <lauren.perry@codethink.co.uk>2015-01-09 16:43:40 +0000
commitc754d504cb3825ab00fe82cf40b2352d21818bda (patch)
treee734e79a002f9e73856b0efb43d1ce01ee2a0de7 /firehose.configure
parent63b5ad5b246df02c5cae2f31075283b385c582c4 (diff)
downloadfirehose-c754d504cb3825ab00fe82cf40b2352d21818bda.tar.gz
Obtain Gerrit user identity and Gerrit URL from firehose.morph during
deployment, rather than hardcoding values, and remove changing of git identity, which is now also set in firehose.morph
Diffstat (limited to 'firehose.configure')
-rw-r--r--firehose.configure33
1 files changed, 26 insertions, 7 deletions
diff --git a/firehose.configure b/firehose.configure
index c17fe59..27a5fe6 100644
--- a/firehose.configure
+++ b/firehose.configure
@@ -3,7 +3,7 @@ set -e
ROOT="$1"
-# Clone the Firehose repo
+# Clone the Firehose repo (temporary hack)
git clone git://git.baserock.org/baserock/baserock/firehose
# Move Firehose arguments to specific directory and timer/service
@@ -28,13 +28,32 @@ systemctl enable firehose.timer
systemctl start firehose.timer
systemctl enable firehose.service
+# Check necessary parameters were filled in firehose.morph before
+# the system was deployed, and exit if not
+if
+ [ -z "$GERRIT_USERNAME" -a \
+ -z "$GERRIT_URL" -a \
+ -z "$GIT_USERNAME" -a \
+ -z "$GIT_EMAIL" -a]; then
+ exit 0
+fi
+
+# Create firehose.conf to store parameters obtained from .morph file
+cat >>"$ROOT"/etc/firehose.conf <<EOF
+[config]
+gerrit_username = $GERRIT_USERNAME
+gerrit_url = $GERRIT_URL
+git_username = $GIT_USERNAME
+git_email = $GIT_EMAIL
+EOF
+
# Add firehose user, then become firehose user
-adduser firehose -s /bin/false -D
-sudo -u firehose --ssh-keygen -C "firehose@baserock.org" -N ""
-sudo chown -R firehose:firehose /var/lib/firehose/
-sudo -u firehose -s
+adduser "$GERRIT_USER" -s /bin/false -D
+sudo -u "$GERRIT_USER" --ssh-keygen -C "$GERRIT_USER@baserock.org" -N ""
+sudo chown -R "$GERRIT_USER":"$GERRIT_USER" /var/lib/firehose
+sudo -u "$GERRIT_USER" -s
# Configure a git identity for Firehose
-git config --global user.name "Firehose"
-git config --global user.email firehose@firehose.baserock.org
+git config --global user.name "$GIT_USER"
+git config --global user.email "$GIT_EMAIL"