diff options
author | Martin Whitaker <mageia@martin-whitaker.me.uk> | 2023-01-28 13:24:03 +0000 |
---|---|---|
committer | Martin Whitaker <mageia@martin-whitaker.me.uk> | 2023-01-28 13:25:51 +0000 |
commit | baffe9d80e364ee415ccdb6bf8bedcdf5ebca478 (patch) | |
tree | 7e359e288756f15b7eb89049c4fc9df2ef1adc93 | |
parent | b7ae651e1ebff07f90ff37be3235b622b469b45a (diff) | |
download | draklive-config-baffe9d80e364ee415ccdb6bf8bedcdf5ebca478.tar draklive-config-baffe9d80e364ee415ccdb6bf8bedcdf5ebca478.tar.gz draklive-config-baffe9d80e364ee415ccdb6bf8bedcdf5ebca478.tar.bz2 draklive-config-baffe9d80e364ee415ccdb6bf8bedcdf5ebca478.tar.xz draklive-config-baffe9d80e364ee415ccdb6bf8bedcdf5ebca478.zip |
Add support for remote repositories in update_bootloader_files.sh.
-rwxr-xr-x | update_bootloader_files.sh | 31 |
1 files 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 |