From 88d91fec021db34ad024f954c90b94368f0ca8c8 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Sat, 28 Jan 2023 13:25:22 +0000 Subject: Add support for remote repositories in update_bootloader_files.sh. --- update_bootloader_files.sh | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/update_bootloader_files.sh b/update_bootloader_files.sh index 7655012..6ab4e2b 100755 --- a/update_bootloader_files.sh +++ b/update_bootloader_files.sh @@ -2,23 +2,50 @@ repository=$(grep repository config/settings.cfg | sed s/repository=//) echo "Fetching bootloader files from $repository" +remote=0 +case $repository in + ftp:* | http:* | https:* ) remote=1;; +esac + # Remove old files rm -rf bootloader mkdir bootloader archs="i586 x86_64" for arch in $archs; do - path=`ls -1v $repository/$arch/media/core/{release,updates}/drakiso-bootloader-files*.rpm 2> /dev/null | tail -1` - if [ -z $path ] ; then + echo "Searching $arch/media/core/updates" + rpm_list=$(urpmq --use-distrib $repository/$arch --media "Core Updates" --exclude-media "Debug,Testing" --curl-options "-s" --wget-options "-q" -r drakiso-bootloader-files) + rpm_name=${rpm_list##*|} + media=core/updates + if [ -z $rpm_name ] ; then + echo "Searching $arch/media/core/release" + rpm_list=$(urpmq --use-distrib $repository/$arch --media "Core Release" --exclude-media "Debug,Testing" --curl-options "-s" --wget-options "-q" -r drakiso-bootloader-files) + rpm_name=${rpm_list##*|} + media=core/release + fi + if [ -z $rpm_name ] ; then echo "ERROR: couldn't find $arch drakiso-bootloader-files RPM in $repository." exit 1 else echo "Extracting $arch bootloader files from repository." + if [ $remote -eq 1 ] ; then + wget -q $repository/$arch/media/$media/$rpm_name.$arch.rpm + if [ $? -ne 0 ] ; then + echo "ERROR: failed to download RPM from archive." + exit 1 + fi + path=$rpm_name.$arch.rpm + else + path=$repository/$arch/media/$media/$rpm_name.$arch.rpm + fi rpm2cpio $path | cpio -idm --quiet if [ $? -ne 0 ] ; then echo "ERROR: failed to extract files from archive." exit 1 fi + if [ $remote -eq 1 ] ; then + rm $path + fi fi cp -ru usr/share/drakiso/bootloader/* bootloader rm -r usr -- cgit v1.2.1