allow peridot repos to be used

This commit is contained in:
Louis Abel 2024-04-13 17:37:08 -07:00
parent acd5a4d17d
commit f4ed5d5b0a
Signed by untrusted user: label
GPG Key ID: 2A6975660E424560

View File

@ -16,12 +16,13 @@ usage: $SCRNAME [OPTIONS]
Options:
-o, --output-dir DIR
-l, --live-image NAME
-p, --peridot ID # optional. will use peridot repos.
-d, --debug # optional
"
OPTS=$(getopt -a -n live-build -o l:,o:,d,h \
-l live-image:,output-dir:,debug,help -- "$@")
OPTS=$(getopt -a -n live-build -o l:,o:,p:,d,h \
-l live-image:,output-dir:,peridot:,debug,help -- "$@")
function is_in_path() {
builtin type -P "${1}"
@ -36,6 +37,7 @@ while :; do
case "$1" in
-l | --live-image) LIVE="$2" ; shift 2 ;;
-o | --output-dir) OUTPUTDIR="$2" ; shift 2 ;;
-p | --peridot) PERIDOTID="$2" ; shift 2 ;;
-d | --debug) DEBUG="--debug" ; shift ;;
-h | --help) usage ;;
--) shift ; break ;;
@ -64,6 +66,19 @@ if [ "$ret_val" -ne "0" ]; then
exit 32
fi
function switch_repo_to_peridot() {
ID="$1"
# https://yumrepofs.build.resf.org/v1/projects/${ID}/repo/
pushd repositories || { echo "not found"; exit 1; }
sed -i "s;ZZ_INTERNAL_BaseOS_REPO_URL_ZZ;https://yumrepofs.build.resf.org/v1/projects/${ID}/repo/BaseOS/\$basearch;g" core-peridot.xml
sed -i "s;ZZ_INTERNAL_AppStream_REPO_URL_ZZ;https://yumrepofs.build.resf.org/v1/projects/${ID}/repo/AppStream/\$basearch;g" core-peridot.xml
sed -i "s;ZZ_INTERNAL_CRB_REPO_URL_ZZ;https://yumrepofs.build.resf.org/v1/projects/${ID}/repo/CRB/\$basearch;g" core-peridot.xml
sed -i "s;ZZ_INTERNAL_extras_REPO_URL_ZZ;https://yumrepofs.build.resf.org/v1/projects/${ID}/repo/extras/\$basearch;g" core-peridot.xml
rm core.xml
ln -s core-peridot.xml core.xml
popd
}
function main() {
/bin/rm config.xml
if [ ! -f "configs/rocky-live-${LIVE,,}.xml" ]; then
@ -71,6 +86,11 @@ function main() {
exit 42
fi
ln -s "configs/rocky-live-${LIVE,,}.xml" config.xml
if [ -n "$PERIDOTID" ]; then
switch_repo_to_peridot "${PERIDOTID}"
fi
kiwi-ng "$DEBUG" --type="iso" --profile="$LIVE-Live" --color-output system build --description="$SCRDIR" --target-dir "$OUTPUTDIR"
}