Browse Source

sde-download: cleaned and removed bashisms

user/chris/old/ruby
Alejandro Mery 15 years ago
parent
commit
c01295efc6
1 changed files with 22 additions and 22 deletions
  1. +22
    -22
      bin/sde-download

+ 22
- 22
bin/sde-download

@ -3,7 +3,7 @@
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: bin/sde-download
# Copyright (C) 2006 - 2008 The OpenSDE Project
# Copyright (C) 2006 - 2009 The OpenSDE Project
# Copyright (C) 2004 - 2006 The T2 SDE Project
# Copyright (C) 1998 - 2003 Clifford Wolf
#
@ -229,6 +229,19 @@ detect_mirror() {
fi
}
download_file_desc() {
sed -n -e 's|^\[D\][ \t]\+||p' "package/$1/$2/$2.desc" |
download_file_pipe "$1" "$2"
}
download_file_pipe() {
local filename=
while read cksum file url; do
filename=$(source_file cksum $file "$url")
download_file "$filename" "$url" "$cksum" "$@"
done
}
# download_file local-filename download-location cksum repo pkg
#
# This function decides if download directly or from a mirror,
@ -677,10 +690,7 @@ required() {
while read on a b repo pkg c ; do
if [ "$on" = "X" ] ; then
grep -H '^\[D\] ' package/$repo/$pkg/$pkg.desc > tmp/down.$$.lst
while read tag cksum file url ; do
download_file "`source_file cksum $file "$url"`" "$url" "$cksum" "$repo" "$pkg"
done < tmp/down.$$.lst ; rm -f tmp/down.$$.lst
download_file_desc "$repo" "$pkg"
fi
done < config/$config/packages
@ -693,11 +703,9 @@ required() {
done
for target in $targetchain; do
if [ -f target/$target/download.txt ] ; then
while read cksum file url ; do
download_file "`source_file cksum $file "$url"`" "$url" "$cksum" "$target"
done < target/$target/download.txt
fi
if [ -f target/$target/download.txt ] ; then
download_file_pipe "$target" < target/$target/download.txt
fi
done
}
@ -708,18 +716,14 @@ all() {
for each in package/$repo/*/*.desc; do
pkg="`echo $each | cut -f3 -d/`"
while read tag cksum file url ; do
download_file "`source_file cksum $file "$url"`" "$url" "$cksum" "$repo" "$pkg"
done < <(grep -H '^\[D\] ' package/$repo/$pkg/$pkg.desc)
download_file_desc "$repo" "$pkg"
done
done
for each in $( ls -1 target/*/download.txt 2> /dev/null ); do
target="`echo $each | cut -f2 -d/`"
while read cksum file url ; do
download_file "`source_file cksum $file "$url"`" "$url" "$cksum" "$target"
done < <(cat $each)
download_file_pipe "$target" < "$each"
done
}
@ -734,9 +738,7 @@ package() {
pkg="`echo $descfile | cut -f3 -d/`"
repo="`echo $descfile | cut -f2 -d/`"
while read tag cksum file url ; do
download_file "`source_file cksum $file "$url"`" "$url" "$cksum" "$repo" "$pkg"
done < <(grep -H '^\[D\] ' package/$repo/$pkg/$pkg.desc)
download_file_desc "$repo" "$pkg"
}
packages() {
@ -751,9 +753,7 @@ packages() {
target="`echo $arg | cut -f2 -d/`"
while read cksum file url ; do
download_file "`source_file cksum $file "$url"`" "$url" "$cksum" "$target"
done < <(cat $arg)
download_file_pipe "$target" < "$arg"
;;
*)
if [ "${arg%.desc}" != "$arg" ]; then

Loading…
Cancel
Save