From 29bacde903177c28b68fad27d4455100f2d0e873 Mon Sep 17 00:00:00 2001 From: gdm85 Date: Mon, 2 Jun 2014 00:52:55 +0200 Subject: [PATCH] * adding scripts for creation/spawning of gitian hosts --- docker/scripts/create-gitian-host.sh | 22 ++++++++++++++++++++++ docker/scripts/spawn-gitian-host.sh | 7 +++++++ 2 files changed, 29 insertions(+) create mode 100755 docker/scripts/create-gitian-host.sh create mode 100755 docker/scripts/spawn-gitian-host.sh diff --git a/docker/scripts/create-gitian-host.sh b/docker/scripts/create-gitian-host.sh new file mode 100755 index 0000000..b6ea0f8 --- /dev/null +++ b/docker/scripts/create-gitian-host.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +cd ../gitian-host || exit $? + +if [ ! -f authorized_keys ]; then + echo "No authorized_keys file found in $PWD" + if [ -f ~/.ssh/id_rsa.pub ]; then + echo "Do you want to use ~/.ssh/id_rsa.pub? (y/n)" + read -r ANSWER + if [[ "$ANSWER" == "y" ]]; then + cp -v ~/.ssh/id_rsa.pub authorized_keys || exit $? + else + exit 1 + fi + else + exit 1 + fi +fi + +docker build --tag=gdm85/gitian-host . && \ +echo "Gitian host image created successfully!" && \ +echo "You can now spawn containers with spawn-gitian-host.sh" diff --git a/docker/scripts/spawn-gitian-host.sh b/docker/scripts/spawn-gitian-host.sh new file mode 100755 index 0000000..63757cf --- /dev/null +++ b/docker/scripts/spawn-gitian-host.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +set -e + +CID=$(docker run -d --privileged gitian-host) || exit $? + +echo "You can now SSH into container $CID (IPv4 $IP) with user debian"