summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/build-rpm-package39
1 files changed, 39 insertions, 0 deletions
diff --git a/bin/build-rpm-package b/bin/build-rpm-package
index ca88489..5b60fa5 100755
--- a/bin/build-rpm-package
+++ b/bin/build-rpm-package
@@ -182,6 +182,45 @@ repeat_str() { # INPUT COUNT
printf "${ret}"
}
+# Creates a custom mock config file given a base config (taken from
+# /etc/mock/), a custom repository file (also taken from /etc/mock/),
+# the build component and the target specification ("full" or "base").
+# Base refers to adding x2go-extras only, while full means also
+# adding the full X2Go upstream repository with all published files.
+# The created config file path is returned.
+create_mock_config () { # MOCK_BASE CUSTOM_REPO COMPONENT TARGET
+ typeset MOCK_BASE="${1:?"Error: no mock base config passed to ${FUNCNAME}()."}"
+ typeset CUSTOM_REPO="${2:?"Error: no mock custom repository file passed to ${FUNCNAME}()."}"
+ typeset COMPONENT="${3:?"Error: no component (X2Go release group) passed to ${FUNCNAME}()."}"
+ typeset TARGET="${4:?"Error: no target (full or base) passed to ${FUNCNAME}()."}"
+
+ typeset ret=""
+
+ # Check argument sanity.
+ typeset i=""
+ for i in MOCK_BASE CUSTOM_REPO; do
+ # Must be plain file.
+ grep -q -s "/" <<< "${!i}" && {
+ echo "Error: ${i} parameter must not be a path but a simple file name." >&2
+ exit -1
+ }
+
+ # Must exist.
+ if [ ! -f "/etc/mock/${!i}" ]; then
+ echo "Error: ${i} parameter must exist and be a regular file." >&2
+ exit -1
+ fi
+ done
+
+ # Note: there is no way to check for the component's validity,
+ # as LTS releases have "random" names assigned to them.
+
+ if [ "${TARGET}" != "base" ] && [ "${TARGET}" != "full" ]; then
+ echo "Error: TARGET parameter must be either full or base." >&2
+ exit -1
+ fi
+}
+
get_extra_repository () {
typeset TYPE="${1:?"Error: no type passed to ${FUNCNAME}()."}"
typeset DIST="${2:?"Error: no distribution passed to ${FUNCNAME}()."}"