2023-09-04 03:01:52 +02:00
|
|
|
#!/bin/bash
|
|
|
|
# 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
|
2023-09-04 03:01:52 +02:00
|
|
|
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
|
|
|
|
|
|
|
|
STAGING_RPM_DIR="$KOJI_DIR/work/imported-rpms"
|
|
|
|
STAGING_RPM_SRC_DIR="$STAGING_RPM_DIR/src"
|
|
|
|
STAGING_RPM_BIN_DIR="$STAGING_RPM_DIR/bin"
|
|
|
|
STAGING_RPM_DEBUG_DIR="$STAGING_RPM_DIR/debug"
|
|
|
|
|
|
|
|
import_koji_pkg() {
|
|
|
|
local src_dir="$1"
|
|
|
|
local dst_dir="$2"
|
|
|
|
local search_pattern="$3"
|
|
|
|
cp -r "$src_dir" "$dst_dir"
|
|
|
|
chown -R "$HTTPD_USER":"$HTTPD_USER" "$dst_dir"
|
|
|
|
find "$dst_dir" -name "$search_pattern" -exec koji import --link {} + > /dev/null
|
|
|
|
}
|
|
|
|
|
|
|
|
if [[ -n "$SRC_RPM_DIR" && -n "$BIN_RPM_DIR" ]]; then
|
|
|
|
ADMIN_KOJI_DIR="$(echo ~kojiadmin)/.koji"
|
|
|
|
cp -r "$ADMIN_KOJI_DIR" "$HOME/.koji"
|
|
|
|
mkdir -p "$STAGING_RPM_DIR"
|
|
|
|
chown -R "$HTTPD_USER":"$HTTPD_USER" "$STAGING_RPM_DIR"
|
|
|
|
|
|
|
|
import_koji_pkg "$SRC_RPM_DIR" "$STAGING_RPM_SRC_DIR" "*.src.rpm"
|
|
|
|
import_koji_pkg "$BIN_RPM_DIR" "$STAGING_RPM_BIN_DIR" "*.$RPM_ARCH.rpm"
|
|
|
|
if [[ -n "$DEBUG_RPM_DIR" ]]; then
|
|
|
|
import_koji_pkg "$DEBUG_RPM_DIR" "$STAGING_RPM_DEBUG_DIR" "*.$RPM_ARCH.rpm"
|
|
|
|
fi
|
|
|
|
|
|
|
|
rm -rf "$STAGING_RPM_DIR" "$HOME/.koji"
|
|
|
|
fi
|
2023-11-06 10:23:40 +01:00
|
|
|
# Generic settings for smeserver
|
|
|
|
PACKAGER="Koozali.org <http://www.koozali.org>"
|
|
|
|
VENDOR="Koozali.org <http://www.koozali.org>"
|
2023-11-06 10:51:04 +01:00
|
|
|
# Setup sme10 for building - based on centos 7 (el7)
|
2023-11-03 12:02:03 +01:00
|
|
|
# sme10-os is the parent - all other sme10 repos will inherit most of this...
|
2023-10-30 04:47:05 +01:00
|
|
|
RELEASE=10
|
2023-11-06 10:23:40 +01:00
|
|
|
DISTRIBUTION="SME Server v$RELEASE"
|
2023-11-06 10:53:15 +01:00
|
|
|
DIST=".el7.sme"
|
2023-11-03 22:44:50 +01:00
|
|
|
PKGMANAGER="yum"
|
|
|
|
BOOTSTRAPIMAGE="centos:7"
|
2023-11-05 01:06:26 +01:00
|
|
|
CHROOTSETUPCMD=' install @buildsys-build @buildsys scl-utils-build python27-build rpm-build '
|
2023-11-03 22:44:50 +01:00
|
|
|
TAG="sme$RELEASE-os"
|
2023-10-30 04:47:05 +01:00
|
|
|
sudo -u kojiadmin koji add-tag dist-"$TAG"
|
|
|
|
sudo -u kojiadmin koji edit-tag dist-"$TAG" -x mock.package_manager=$PKGMANAGER
|
|
|
|
sudo -u kojiadmin koji add-tag --parent dist-"$TAG" --arches "$RPM_ARCH" dist-"$TAG"-build
|
|
|
|
sudo -u kojiadmin koji add-target dist-"$TAG" dist-"$TAG"-build
|
2023-11-06 11:04:48 +01:00
|
|
|
sudo -u kojiadmin koji edit-tag -x mock.bootstrap_image="$BOOTSTRAPIMAGE" dist-"$TAG"
|
|
|
|
sudo -u kojiadmin koji edit-tag -x mock.chroot_setup_cmd="$CHROOTSETUPCMD" dist-"$TAG"
|
|
|
|
sudo -u kojiadmin koji edit-tag -x rpm.macro.distribution="$DISTRIBUTION" dist-"$TAG"
|
|
|
|
sudo -u kojiadmin koji edit-tag -x rpm.macro.packager="$PACKAGER" dist-"$TAG"
|
|
|
|
sudo -u kojiadmin koji edit-tag -x rpm.macro.vendor="$VENDOR" dist-"$TAG"
|
|
|
|
sudo -u kojiadmin koji edit-tag -x rpm.macro.dist="$DIST" dist-"$TAG"
|
2023-10-30 04:47:05 +01:00
|
|
|
sudo -u kojiadmin koji add-group dist-"$TAG"-build build
|
|
|
|
sudo -u kojiadmin koji add-group dist-"$TAG"-build srpm-build
|
2023-11-05 01:06:26 +01:00
|
|
|
sudo -u kojiadmin koji add-group-pkg dist-"$TAG"-build build install @buildsys-build @buildsys scl-utils-build python27-build rpm-build
|
2023-11-02 21:46:29 +01:00
|
|
|
sudo -u kojiadmin koji add-group-pkg dist-"$TAG"-build srpm-build rpm-build coreutils cpio curl-bin elfutils file git glibc-utils grep gzip make pigz plzip rpm sed shadow tar unzip wget xz
|
2023-11-03 22:44:50 +01:00
|
|
|
sudo -u kojiadmin koji add-external-repo -t dist-"$TAG"-build os http://buildsys.koozali.org/build/7/os/\$arch/
|
|
|
|
sudo -u kojiadmin koji add-external-repo -t dist-"$TAG"-build updates http://buildsys.koozali.org/build/7/updates/\$arch/
|
|
|
|
sudo -u kojiadmin koji add-external-repo -t dist-"$TAG"-build smeos http://buildsys.koozali.org/build/10/smeos/\$arch/
|
|
|
|
sudo -u kojiadmin koji add-external-repo -t dist-"$TAG"-build smeupdates http://buildsys.koozali.org/build/10/smeupdates/\$arch/
|
|
|
|
sudo -u kojiadmin koji add-external-repo -t dist-"$TAG"-build fastrack http://buildsys.koozali.org/build/7/fastrack/\$arch/
|
|
|
|
sudo -u kojiadmin koji add-external-repo -t dist-"$TAG"-build opt1 http://buildsys.koozali.org/build/7/opt1/\$arch/
|
|
|
|
sudo -u kojiadmin koji add-external-repo -t dist-"$TAG"-build opt2 http://buildsys.koozali.org/build/7/opt2/\$arch/
|
|
|
|
sudo -u kojiadmin koji add-external-repo -t dist-"$TAG"-build opt3 http://buildsys.koozali.org/build/7/opt3/\$arch/
|
|
|
|
sudo -u kojiadmin koji add-external-repo -t dist-"$TAG"-build epel http://download.fedoraproject.org/pub/epel/7/\$arch/
|
|
|
|
sudo -u kojiadmin koji add-external-repo -t dist-"$TAG"-build openfusion http://repo.openfusion.net/centos7-\$arch/
|
|
|
|
sudo -u kojiadmin koji add-external-repo -t dist-"$TAG"-build rpmfusion http://download1.rpmfusion.org/free/el/updates/7/\$arch/
|
|
|
|
sudo -u kojiadmin koji add-external-repo -t dist-"$TAG"-build sclo-sclo http://mirror.centos.org/centos/7/sclo/\$arch/sclo
|
|
|
|
sudo -u kojiadmin koji add-external-repo -t dist-"$TAG"-build sclo-rh http://mirror.centos.org/centos/7/sclo/\$arch/rh
|
|
|
|
sudo -u kojiadmin koji add-external-repo -t dist-"$TAG"-build buildsys-core http://buildsys.koozali.org/build/10/smeserver-core/\$arch/
|
|
|
|
sudo -u kojiadmin koji add-external-repo -t dist-"$TAG"-build buildsys-contribs http://buildsys.koozali.org/build/10/smeserver-contribs/\$arch/
|
|
|
|
sudo -u kojiadmin koji add-external-repo -t dist-"$TAG"-build groups http://buildsys.koozali.org/build/10/smeserver-groups/\$arch/
|
2023-11-05 00:42:31 +01:00
|
|
|
sudo -u kojiadmin koji regen-repo dist-"$TAG"-build --nowait
|
2023-11-06 03:55:26 +01:00
|
|
|
# Only build for smeos and smecontribs - others are staging
|
|
|
|
TAG="sme$RELEASE-contribs"
|
|
|
|
sudo -u kojiadmin koji add-tag --parent dist-sme$RELEASE-os dist-"$TAG"
|
|
|
|
sudo -u kojiadmin koji add-tag --parent dist-$TAG --arches="$RPM_ARCH" dist-$TAG-build
|
|
|
|
sudo -u kojiadmin koji add-target dist-"$TAG" dist-"$TAG"-build
|
|
|
|
sudo -u kojiadmin koji add-tag-inheritance dist-$TAG-build dist-sme$RELEASE-os --priority 10
|
|
|
|
sudo -u kojiadmin koji edit-tag dist-"$TAG" -x mock.bootstrap_image="$BOOTSTRAPIMAGE"
|
|
|
|
sudo -u kojiadmin koji edit-tag dist-"$TAG" -x mock.chroot_setup_cmd="$CHROOTSETUPCMD"
|
|
|
|
sudo -u kojiadmin koji add-group dist-"$TAG"-build build
|
|
|
|
sudo -u kojiadmin koji add-group dist-"$TAG"-build srpm-build
|
|
|
|
sudo -u kojiadmin koji add-group-pkg dist-"$TAG"-build build install @buildsys-build @buildsys scl-utils-build python27-build rpm-build
|
|
|
|
sudo -u kojiadmin koji add-group-pkg dist-"$TAG"-build srpm-build rpm-build coreutils cpio curl-bin elfutils file git glibc-utils grep gzip make pigz plzip rpm sed shadow tar unzip wget xz
|
|
|
|
sudo -u kojiadmin koji regen-repo dist-$TAG-build --nowait
|
2023-10-30 04:47:05 +01:00
|
|
|
# setup the rest of the sme10 repos
|
2023-11-06 03:55:26 +01:00
|
|
|
for REPO in addons updates updates-testing testing ; do
|
2023-11-03 22:44:50 +01:00
|
|
|
TAG="sme$RELEASE-$REPO"
|
2023-10-30 04:47:05 +01:00
|
|
|
sudo -u kojiadmin koji add-tag --parent dist-sme$RELEASE-os dist-"$TAG"
|
2023-09-11 07:39:19 +02:00
|
|
|
done
|
2023-11-06 03:55:26 +01:00
|
|
|
|
2023-11-06 10:23:40 +01:00
|
|
|
# Releases sme11 and sme12 are based on Rocky 8 (EL8)
|
2023-11-03 22:44:50 +01:00
|
|
|
EL="8"
|
2023-11-06 10:53:15 +01:00
|
|
|
DIST=".el$EL.sme"
|
2023-11-06 10:23:40 +01:00
|
|
|
PKGMANAGER="dnf"
|
|
|
|
BOOTSTRAPIMAGE="rockylinux:$EL"
|
2023-11-06 10:46:28 +01:00
|
|
|
CHROOTSETUPCMD=' install epel-rpm-macros bash bzip2 coreutils cpio diffutils findutils gawk gcc gcc-c++ grep gzip info make patch redhat-rpm-config rpm-build sed shadow-utils tar unzip util-linux which yum-utils xz '
|
2023-11-06 08:16:16 +01:00
|
|
|
sudo -u kojiadmin koji add-external-repo os$EL https://dl.rockylinux.org/pub/rocky/$EL/BaseOS/x86_64/os/
|
|
|
|
# mirrorList=http://mirrors.rockylinux.org/mirrorlist?release=$EL&arch=x86_64&repo=BaseOS-$EL
|
|
|
|
sudo -u kojiadmin koji add-external-repo appstream$EL https://dl.rockylinux.org/pub/rocky/$EL/AppStream/x86_64/os/
|
|
|
|
# mirrorlist = https://mirrors.rockylinux.org/mirrorlist?arch=x86_64&repo=AppStream-8
|
|
|
|
sudo -u kojiadmin koji add-external-repo powertools$EL https://dl.rockylinux.org/pub/rocky/$EL/PowerTools/x86_64/os/
|
|
|
|
# mirrorlist = https://mirrors.rockylinux.org/mirrorlist?arch=x86_64&repo=PowerTools-$EL
|
|
|
|
sudo -u kojiadmin koji add-external-repo epel$EL https://muug.ca/mirror/fedora-epel/$EL/Everything/x86_64/
|
|
|
|
# mirrorList=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-8&arch=x86_64
|
|
|
|
sudo -u kojiadmin koji add-external-repo openfusion$EL http://repo.openfusion.net/centos$EL-x86_64
|
|
|
|
sudo -u kojiadmin koji add-external-repo rpmfusion$EL http://download1.rpmfusion.org/free/el/updates/$EL/x86_64
|
2023-11-04 00:00:55 +01:00
|
|
|
for RELEASE in 11 12 ; do
|
2023-10-30 04:47:05 +01:00
|
|
|
# Setup the os repo - parent of others who will inherit most properties
|
2023-11-06 10:23:40 +01:00
|
|
|
DISTRIBUTION="SME Server v$RELEASE"
|
2023-11-03 22:44:50 +01:00
|
|
|
TAG="sme$RELEASE-os"
|
2023-10-30 04:47:05 +01:00
|
|
|
sudo -u kojiadmin koji add-tag dist-"$TAG"
|
2023-11-06 11:04:48 +01:00
|
|
|
sudo -u kojiadmin koji edit-tag dist-"$TAG" -x mock.package_manager="$PKGMANAGER"
|
2023-10-30 04:47:05 +01:00
|
|
|
sudo -u kojiadmin koji add-tag --parent dist-"$TAG" --arches "$RPM_ARCH" dist-"$TAG"-build
|
|
|
|
sudo -u kojiadmin koji add-target dist-"$TAG" dist-"$TAG"-build
|
|
|
|
sudo -u kojiadmin koji add-group dist-"$TAG"-build build
|
|
|
|
sudo -u kojiadmin koji add-group dist-"$TAG"-build srpm-build
|
2023-11-06 11:04:48 +01:00
|
|
|
sudo -u kojiadmin koji edit-tag -x mock.bootstrap_image="$BOOTSTRAPIMAGE" dist-"$TAG"
|
|
|
|
sudo -u kojiadmin koji edit-tag -x mock.chroot_setup_cmd="$CHROOTSETUPCMD" dist-"$TAG"
|
|
|
|
sudo -u kojiadmin koji edit-tag -x rpm.macro.distribution="$DISTRIBUTION" dist-"$TAG"
|
|
|
|
sudo -u kojiadmin koji edit-tag -x rpm.macro.packager="$PACKAGER" dist-"$TAG"
|
|
|
|
sudo -u kojiadmin koji edit-tag -x rpm.macro.vendor="$VENDOR" dist-"$TAG"
|
|
|
|
sudo -u kojiadmin koji edit-tag -x rpm.macro.dist="$DIST" dist-"$TAG"
|
2023-11-06 10:46:28 +01:00
|
|
|
sudo -u kojiadmin koji add-group-pkg dist-"$TAG"-build build epel-rpm-macros bash bzip2 coreutils cpio diffutils findutils gawk gcc gcc-c++ grep gzip info make patch redhat-rpm-config rpm-build sed shadow-utils tar unzip util-linux which yum-utils xz
|
|
|
|
sudo -u kojiadmin koji add-group-pkg dist-"$TAG"-build srpm-build coreutils cpio curl-bin elfutils file git glibc-utils grep gzip make pigz plzip rpm rpm-build sed shadow tar unzip wget xz
|
2023-11-06 08:16:16 +01:00
|
|
|
sudo -u kojiadmin koji add-external-repo -t dist-"$TAG"-build os$EL
|
|
|
|
sudo -u kojiadmin koji add-external-repo -t dist-"$TAG"-build appstream$EL
|
|
|
|
sudo -u kojiadmin koji add-external-repo -t dist-"$TAG"-build powertools$EL
|
|
|
|
sudo -u kojiadmin koji add-external-repo -t dist-"$TAG"-build epel$EL
|
|
|
|
sudo -u kojiadmin koji add-external-repo -t dist-"$TAG"-build openfusion$EL
|
|
|
|
sudo -u kojiadmin koji add-external-repo -t dist-"$TAG"-build rpmfusion$EL
|
2023-11-05 00:42:31 +01:00
|
|
|
sudo -u kojiadmin koji regen-repo dist-"$TAG"-build --nowait
|
2023-11-06 04:00:15 +01:00
|
|
|
# Only build for smeos and smecontribs - others are staging
|
|
|
|
TAG="sme$RELEASE-contribs"
|
|
|
|
sudo -u kojiadmin koji add-tag --parent dist-sme$RELEASE-os dist-"$TAG"
|
|
|
|
sudo -u kojiadmin koji add-tag --parent dist-$TAG --arches="$RPM_ARCH" dist-$TAG-build
|
|
|
|
sudo -u kojiadmin koji add-target dist-"$TAG" dist-"$TAG"-build
|
|
|
|
sudo -u kojiadmin koji add-tag-inheritance dist-$TAG-build dist-sme$RELEASE-os --priority 10
|
|
|
|
sudo -u kojiadmin koji edit-tag dist-"$TAG" -x mock.bootstrap_image="$BOOTSTRAPIMAGE"
|
|
|
|
sudo -u kojiadmin koji edit-tag dist-"$TAG" -x mock.chroot_setup_cmd="$CHROOTSETUPCMD"
|
|
|
|
sudo -u kojiadmin koji add-group dist-"$TAG"-build build
|
|
|
|
sudo -u kojiadmin koji add-group dist-"$TAG"-build srpm-build
|
2023-11-06 10:46:28 +01:00
|
|
|
sudo -u kojiadmin koji add-group-pkg dist-"$TAG"-build build epel-rpm-macros bash bzip2 coreutils cpio diffutils findutils gawk gcc gcc-c++ grep gzip info make patch redhat-rpm-config rpm-build sed shadow-utils tar unzip util-linux which yum-utils xz
|
|
|
|
sudo -u kojiadmin koji add-group-pkg dist-"$TAG"-build srpm-build rpm-build coreutils cpio curl-bin elfutils file git glibc-utils grep gzip make pigz plzip rpm sed shadow tar unzip wget xz
|
2023-11-06 04:00:15 +01:00
|
|
|
sudo -u kojiadmin koji regen-repo dist-$TAG-build --nowait
|
2023-10-30 04:47:05 +01:00
|
|
|
# setup the rest of the repos
|
2023-11-06 04:00:15 +01:00
|
|
|
for REPO in addons updates updates-testing testing ; do
|
2023-11-03 22:44:50 +01:00
|
|
|
TAG="sme$RELEASE-$REPO"
|
2023-10-30 04:47:05 +01:00
|
|
|
sudo -u kojiadmin koji add-tag --parent dist-sme$RELEASE-os dist-"$TAG"
|
|
|
|
done
|
|
|
|
done
|