summaryrefslogtreecommitdiff
path: root/firehose.configure
diff options
context:
space:
mode:
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"