#!/bin/sh set -e ROOT="$1" # Check necessary parameters were filled in firehose.morph before # the system was deployed, and exit if not if [ -z "$GERRIT_USERNAME" -o \ -z "$GERRIT_USER" -o \ -z "$GERRIT_URL" -o \ -z "$GIT_USERNAME" -o \ -z "$GIT_EMAIL" ]; then exit 0 fi # Add firehose user chroot "$ROOT" adduser "$GERRIT_USER" -s /bin/false -D chroot "$ROOT" sudo -u "$GERRIT_USER" ssh-keygen -C "$GERRIT_USER@baserock.org" -N "" # Clone the Firehose repo (temporary hack) git clone git://git.baserock.org/baserock/baserock/firehose "$ROOT/home/firehose/firehose" cd "$ROOT/home/firehose/firehose" # Move Firehose arguments to specific directory and timer/service # files to /etc/systemd mkdir -p "$ROOT/var/lib/firehose" cp examples/*.yaml "$ROOT/var/lib/firehose/" chroot "$ROOT" sudo chown -R "$GERRIT_USER":"$GERRIT_USER" /var/lib/firehose cp firehose.service "$ROOT/etc/systemd/system/firehose.service" cp firehose.timer "$ROOT/etc/systemd/system/firehose.timer" # Run the Firehose install script chroot "$ROOT" sh -c 'cd /home/firehose/firehose/ && /usr/bin/python ./setup.py install' - cat >>"$ROOT/etc/morph.conf" <>"$ROOT/etc/firehose.conf" <