Browse Source

* adapted lib/sde-download/mirror-test.sh to use bin/sde-config-ini

* adapted bin/sde-download to use bin/sde-config-ini
	* cleaned old compatibility warnings and added some safety checks on bin/sde-download


git-svn-id: svn://svn.opensde.net/opensde/opensde/trunk@21682 10447126-35f2-4685-b0cf-6dd780d3921f
misl/sde-wrapper
Alejandro Mery 17 years ago
parent
commit
62289d6a07
2 changed files with 14 additions and 19 deletions
  1. +8
    -15
      bin/sde-download
  2. +6
    -4
      lib/sde-download/mirror-test.sh

+ 8
- 15
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>."

+ 6
- 4
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"

Loading…
Cancel
Save