diff options
author | Lauren Perry <lauren.perry@codethink.co.uk> | 2015-01-09 17:46:09 +0000 |
---|---|---|
committer | Lauren Perry <lauren.perry@codethink.co.uk> | 2015-01-09 17:46:09 +0000 |
commit | 7965ebf71bf3270a30eff3cbb842c6c609c3dec9 (patch) | |
tree | d01fe7da02a601a4a295661299b52818e2c2ddde | |
parent | c754d504cb3825ab00fe82cf40b2352d21818bda (diff) | |
download | firehose-7965ebf71bf3270a30eff3cbb842c6c609c3dec9.tar.gz |
Perform firehose.configure commands in deployed system, not developmentbaserock/lauren/firehose
-rw-r--r-- | firehose.configure | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/firehose.configure b/firehose.configure index 27a5fe6..7d129dd 100644 --- a/firehose.configure +++ b/firehose.configure @@ -3,30 +3,35 @@ set -e ROOT="$1" +# 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 "" +chroot "$ROOT" sudo chown -R "$GERRIT_USER":"$GERRIT_USER" /var/lib/firehose +cd "$ROOT/home/firehose/" + # Clone the Firehose repo (temporary hack) git clone git://git.baserock.org/baserock/baserock/firehose # Move Firehose arguments to specific directory and timer/service # files to /etc/systemd -mkdir -p "$ROOT"/var/lib/firehose -cd firehose/ -cp examples/*.yaml "$ROOT"/var/lib/firehose/ -cp firehose.service "$ROOT"/etc/systemd/system/firehose.service -cp firehose.timer "$ROOT"/etc/systemd/system/firehose.timer +mkdir -p "$ROOT/var/lib/firehose" +cp examples/*.yaml "$ROOT/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 -/usr/bin/python ./setup.py install +chroot "$ROOT" /usr/bin/python ./setup.py install -cat >>"$ROOT"/etc/morph.conf <<EOF +cat >>"$ROOT/etc/morph.conf" <<EOF [config] repo-alias=baserock=git://git.baserock.org/baserock/#ssh://firehose@testgerrit.baserock.org:29418/baserock/,upstream=git://git.baserock.org/delta/#ssh://firehose@testgerrit.baserock.org:29418/delta/ EOF # This will run Firehose on the argument specified in firehose.timer # automatically every six hours -systemctl enable firehose.timer -systemctl start firehose.timer -systemctl enable firehose.service +chroot "$ROOT" systemctl enable firehose.timer +chroot "$ROOT" systemctl start firehose.timer +chroot "$ROOT" systemctl enable firehose.service # Check necessary parameters were filled in firehose.morph before # the system was deployed, and exit if not @@ -39,7 +44,7 @@ if fi # Create firehose.conf to store parameters obtained from .morph file -cat >>"$ROOT"/etc/firehose.conf <<EOF +cat >>"$ROOT/etc/firehose.conf" <<EOF [config] gerrit_username = $GERRIT_USERNAME gerrit_url = $GERRIT_URL @@ -47,13 +52,12 @@ git_username = $GIT_USERNAME git_email = $GIT_EMAIL EOF -# Add firehose user, then become firehose user -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 +# Become firehose user +chroot "$ROOT" sudo -u "$GERRIT_USER" -s # Configure a git identity for Firehose +cat >>"$ROOT/home/firehose/.gitconfig" <<EOF git config --global user.name "$GIT_USER" git config --global user.email "$GIT_EMAIL" +EOF |