quieten output a little

This commit is contained in:
Trevor Batley 2023-09-01 16:59:55 +10:00
parent a1d482f508
commit cbf5671b53

View File

@ -1,27 +1,23 @@
#!/bin/bash
for param in $1 $2 $3 $4 $5 $6; do
DEBUG=
for param in $1 $2 $3 ; do
if [ $param ] ; then
case $param in
local )
GITEAUser=${local_USER}
GITEAACCESSTOKEN=${local_GITEAACCESSTOKEN}
GITEAHOST=${local_GITEAHOST}
;;
debug )
DEBUG=true ;;
noisy )
NOISY=true ;;
* )
EXTRAPARAMS=$EXTRAPARAMS" "$param ;;
esac
else
break
fi
done
SILENT="-s"
QUIET="-q"
if [ $DEBUG ] ; then
set -xe
SILENT=
QUIET="-v"
else
set -e
fi
@ -30,9 +26,9 @@ fi
SCRIPT_GIT="https://src.koozali.org/smedev/smeserver-koji/raw/branch/master/koji-setup"
SCRIPT_DIR="$(echo ~)/bin"
mkdir -p $SCRIPT_DIR
curl $SCRIPT_GIT/gencert.sh > $SCRIPT_DIR/gencert.sh
curl $SCRIPT_GIT/deploy-koji.sh > $SCRIPT_DIR/deploy-koji.sh
curl $SCRIPT_GIT/bootstrap-build.sh > $SCRIPT_DIR/bootstrap-build.sh
curl $SILENT $SCRIPT_GIT/gencert.sh > $SCRIPT_DIR/gencert.sh
curl $SILENT $SCRIPT_GIT/deploy-koji.sh > $SCRIPT_DIR/deploy-koji.sh
curl $SILENT $SCRIPT_GIT/bootstrap-build.sh > $SCRIPT_DIR/bootstrap-build.sh
chmod o+x $SCRIPT_DIR/*.sh
# ask for required parameters (ssh settings and build server FQDN)
@ -116,7 +112,7 @@ deploy-koji.sh
# if there is a separate koji builder deploy that
if [ "$KOJI_BUILD_FQDN" != "$KOJI_HUB_FQDN" ] ; then
# add nfs share for koji files direcory
curl $SCRIPT_GIT/deploy-koji-nfs-server.sh > $SCRIPT_DIR/deploy-koji-nfs-server.sh
curl $SILENT $SCRIPT_GIT/deploy-koji-nfs-server.sh > $SCRIPT_DIR/deploy-koji-nfs-server.sh
chmod o+x $SCRIPT_DIR/deploy-koji-nfs-server.sh
deploy-koji-nfs-server.sh
# create a ssh key and add to authorized keys on build server
@ -124,22 +120,21 @@ if [ "$KOJI_BUILD_FQDN" != "$KOJI_HUB_FQDN" ] ; then
ssh-keygen -t rsa -f /root/.ssh/id_rsa -N ""
ssh-copy-id -i ~/.ssh/id_rsa.pub $KOJI_BUILD_FQDN
# copy across the ssl keys
ssh root@$KOJI_BUILD_FQDN mkdir $KOJI_PKI_DIR
scp $KOJI_PKI_DIR/$KOJI_BUILD_FQDN.pem root@$KOJI_BUILD_FQDN:$KOJI_PKI_DIR/.
scp $KOJI_PKI_DIR/koji_ca_cert.crt root@$KOJI_BUILD_FQDN:$KOJI_PKI_DIR/.
ssh $QUIET root@$KOJI_BUILD_FQDN mkdir $KOJI_PKI_DIR
scp $QUIET $KOJI_PKI_DIR/$KOJI_BUILD_FQDN.pem root@$KOJI_BUILD_FQDN:$KOJI_PKI_DIR/.
scp $QUIET $KOJI_PKI_DIR/koji_ca_cert.crt root@$KOJI_BUILD_FQDN:$KOJI_PKI_DIR/.
# copy across the parameter files (we built them on the hub)
ssh root@$KOJI_BUILD_FQDN
scp $SCRIPT_DIR/globals.sh root@$KOJI_BUILD_FQDN:$SCRIPT_DIR/globals.sh
scp $SCRIPT_DIR/parameters.sh root@$KOJI_BUILD_FQDN:$SCRIPT_DIR/parameters.sh
scp $QUIET $SCRIPT_DIR/globals.sh root@$KOJI_BUILD_FQDN:$SCRIPT_DIR/globals.sh
scp $QUIET $SCRIPT_DIR/parameters.sh root@$KOJI_BUILD_FQDN:$SCRIPT_DIR/parameters.sh
# pull down the required scripts
ssh root@$KOJI_BUILD_FQDN "curl $SCRIPT_GIT/deploy-koji-nfs-client.sh > $SCRIPT_DIR/deploy-koji-nfs-client.sh"
ssh root@$KOJI_BUILD_FQDN "curl $SCRIPT_GIT/deploy-koji-builder.sh > $SCRIPT_DIR/deploy-koji-builder.sh"
ssh $QUIET root@$KOJI_BUILD_FQDN "curl $SILENT $SCRIPT_GIT/deploy-koji-nfs-client.sh > $SCRIPT_DIR/deploy-koji-nfs-client.sh"
ssh $QUIET root@$KOJI_BUILD_FQDN "curl $SILENT $SCRIPT_GIT/deploy-koji-builder.sh > $SCRIPT_DIR/deploy-koji-builder.sh"
# make them executeable
ssh root@$KOJI_BUILD_FQDN chmod o+x $SCRIPT_DIR/*
ssh $QUIET root@$KOJI_BUILD_FQDN chmod o+x $SCRIPT_DIR/*
# connect to nfs share
ssh root@$KOJI_BUILD_FQDN $SCRIPT_DIR/deploy-koji-nfs-client.sh
ssh $QUIET root@$KOJI_BUILD_FQDN $SCRIPT_DIR/deploy-koji-nfs-client.sh
# deploy koji builder
ssh root@$KOJI_BUILD_FQDN $SCRIPT_DIR/deploy-koji-builder.sh
ssh $QUIET root@$KOJI_BUILD_FQDN $SCRIPT_DIR/deploy-koji-builder.sh
fi
#