From 6a260a1d458c4ab225d233f612349cf162796d87 Mon Sep 17 00:00:00 2001 From: Josef Skladanka Date: Aug 07 2017 11:56:07 +0000 Subject: Taskotron init script PoC Summary: Script that inits taskotron and testcloud after installation. This is PoC to open a discussion what else we'd like to see in init script. Test Plan: run the script Reviewers: kparal, tflink, mkrizek, jskladan Subscribers: tflink Tags: #libtaskotron Differential Revision: https://phab.qa.fedoraproject.org/D966 --- diff --git a/taskotron_init.sh b/taskotron_init.sh new file mode 100755 index 0000000..42d29b0 --- /dev/null +++ b/taskotron_init.sh @@ -0,0 +1,63 @@ +#!/usr/bin/env bash + + +# check if init was done already +if [ -f $HOME/.config/taskotron/init_done ]; then + echo -n "Taskotron and testcloud already initialized, do you want to redo the init? " + read -r -p "[y/N] " response + response=${response,,} #to lower + if [[ $response =~ ^(yes|y)$ ]]; then + rm -f /var/lib/taskotron/init_done + else + exit 1 + fi +fi + +# get the path to pubkey +PUBKEY_PATH= +if [ -f ~/.ssh/id_rsa.pub ]; then + echo -n "Enter path to ssh pubkey (leave empty to use ~/.ssh/id_rsa.pub):" + read PUBKEY_PATH + if [ -z "$PUBKEY_PATH" ]; then + PUBKEY_PATH="$HOME/.ssh/id_rsa.pub" + fi +else + echo -n "Enter path to ssh pubkey:" + read PUBKEY_PATH + if [ -z "$PUBKEY_PATH" ]; then + echo "No pubkey specified, exiting." + exit 1 + fi +fi + +# read the pubkey +PUBKEY= +if [ -f $PUBKEY_PATH ]; then + PUBKEY=`cat $PUBKEY_PATH` +else + echo "File $PUBKEY_PATH does not exist." + exit 1 +fi + +# generate config for testcloud +mkdir -p $HOME/.config/testcloud +cat > $HOME/.config/testcloud/settings.py <