diff --git a/bin/sde-download b/bin/sde-download index ebf64d0..28982b5 100755 --- a/bin/sde-download +++ b/bin/sde-download @@ -24,7 +24,6 @@ set -e export SDEROOT=$( cd "${0%/*}/.."; pwd -P ) . $SDEROOT/lib/libsde.in -. $SDEROOT/lib/libsde-ini.in # to write . $SDEROOT/lib/functions.in download_usage() { @@ -75,17 +74,8 @@ mkdir -p tmp/ download/ config=default mirror= altdir= proxy= proxyauth= if [ -s "$SDESETTINGS" ]; then - eval $( ini_section_read "$SDESETTINGS" download ) - eval $( ini_section_read "$SDESETTINGS" download-$sdever ) -elif [ -s "$HOME/.sde/download" ]; then - # import old $HOME/.sde/download - . "$HOME/.sde/download" - ini_write "$SDESETTINGS" 'download' altdir -fi - -# deprecation of $HOME/.sde/download -if [ -f "$HOME/.sde/download" ]; then - echo_warning "\$HOME/.sde/download is deprecated." 1>&2 + eval $( $SDEROOT/bin/sde-config-ini -F "$SDESETTINGS" download ) + eval $( $SDEROOT/bin/sde-config-ini -F "$SDESETTINGS" download-$sdever ) fi this_is_the_2nd_run=0 @@ -133,7 +123,7 @@ while [ $# -gt 0 ]; do else options="$options -mirror $2" mirror="$2" - ini_write "$SDESETTINGS" download-$sdever mirror + $SDEROOT/bin/sde-config-ini -F "$SDESETTINGS" "download-$sdever.mirror=$mirror" fi shift ;; @@ -223,9 +213,12 @@ detect_mirror() { fi 2>&1 | echo_info # read new mirror info - eval $( ini_section_read "$SDESETTINGS" download-$sdever ) + mirror= + eval $( $SDEROOT/bin/sde-config-ini -F "$SDESETTINGS" download-$sdever ) - if [ "$mirror" == "broken" ]; then + if [ -z "$mirror" ]; then + echo_error "Mirror detection loop hit a bug!" + elif [ "$mirror" == "broken" ]; then echo_warning "No Mirror Found!" else echo_info "Using mirror <$mirror>." diff --git a/lib/sde-download/mirror-test.sh b/lib/sde-download/mirror-test.sh index a57f87a..c566826 100644 --- a/lib/sde-download/mirror-test.sh +++ b/lib/sde-download/mirror-test.sh @@ -2,7 +2,7 @@ # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # # Filename: lib/sde-download/mirror-test.sh -# Copyright (C) 2006 The OpenSDE Project +# Copyright (C) 2006 - 2007 The OpenSDE Project # # More information can be found in the files COPYING and README. # @@ -14,9 +14,10 @@ maxspeed=0 mirror= -SDEROOT=$PWD +[ -n "$SDEROOT" ] || + export SDEROOT=$( cd "${0%/*}/../.."; pwd -P ) + . $SDEROOT/lib/libsde.in -. $SDEROOT/lib/libsde-ini.in # to write OLDIFS="$IFS" IFS=":" while read name country admin url ; do @@ -49,4 +50,5 @@ done < <( sed -e '/^#/d;' $1 ) IFS="$OLDIFS" [ -n "$mirror" ] || mirror=broken -ini_write "$SDESETTINGS" "download-$sdever" mirror + +$SDEROOT/bin/sde-config-ini -F "$SDESETTINGS" "download-$sdever.mirror=$mirror"