smeserver-koji/koji-setup/koji-deploy-builder.sh

92 lines
2.1 KiB
Bash
Raw Normal View History

#!/bin/bash
# Copyright (C) 2019 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
set -e
DEBUG=
SILENT="-s"
QUIET="-q"
for param in $1 $2 ; do
if [ $param ] ; then
case $param in
debug )
DEBUG="debug" ;;
esac
else
break
fi
done
if [ $DEBUG ] ; then
2023-09-04 12:30:28 +02:00
set -xe
SILENT=
QUIET="-v"
fi
# load required parameters
SCRIPT_DIR="$(dirname "$(realpath "$0")")"
if [ ! -f "$SCRIPT_DIR"/koji-parameters.sh ] ; then
echo "$SCRIPT_DIR/koji-parameters.sh NOT found - aborting"
exit 1
fi
source "$SCRIPT_DIR"/koji-parameters.sh
KOJI_BUILD_FQDN="$(hostname -f)"
# Install the koji builder componelts from epel
2023-09-04 12:53:48 +02:00
if [[ -z $(dnf list installed | grep epel-release) ]] ; then
dnf install -y epel-release $QUIET
fi
2023-09-04 12:53:48 +02:00
if [[ -z $(dnf list installed | grep koji-builder) ]] ; then
2023-09-04 12:30:28 +02:00
dnf install -y koji-builder $QUIET
fi
2024-03-08 23:53:08 +01:00
if [[ -z $(dnf list installed | grep git-lfs) ]] ; then
dnf install -y git-lfs $QUIET
fi
# Create mock folders and permissions
mkdir -p /etc/mock/koji
mkdir -p /var/lib/mock
chown -R root:mock /var/lib/mock
# Setup User Accounts
# useradd -r kojibuilder
usermod -G mock kojibuilder
# Kojid Configuration Files
KOJI_TOP_DIR="$KOJI_DIR"
mkdir -p /etc/kojid
cat > /etc/kojid/kojid.conf <<- EOF
[kojid]
sleeptime=5
maxjobs=16
topdir=$KOJI_TOP_DIR
workdir=/tmp/koji
mockdir=/var/lib/mock
mockuser=kojibuilder
mockhost=generic-linux-gnu
user=$KOJI_BUILD_FQDN
server=$KOJI_URL/kojihub
topurl=$KOJI_URL/kojifiles
use_createrepo_c=True
2023-11-07 23:33:53 +01:00
allowed_scms=:/packages/* $KOJI_ALLOWED_SCMS
cert = $KOJI_PKI_DIR/$KOJI_BUILD_FQDN.pem
serverca = $KOJI_PKI_DIR/koji_ca_cert.crt
2023-11-04 23:46:46 +01:00
mock_bootstrap_image=False
2023-11-07 09:46:43 +01:00
packager="Koozali.org <http://www.koozali.org>"
vendor="Koozali.org <http://www.koozali.org>"
EOF
if env | grep -q proxy; then
echo "yum_proxy = $https_proxy" >> /etc/kojid/kojid.conf
mkdir -p /etc/systemd/system/kojid.service.d
cat > /etc/systemd/system/kojid.service.d/00-proxy.conf <<- EOF
[Service]
Environment="http_proxy=$http_proxy"
Environment="https_proxy=$https_proxy"
Environment="no_proxy=$no_proxy"
EOF
systemctl daemon-reload
fi
systemctl enable --now kojid