2 # --- SDE-COPYRIGHT-NOTE-BEGIN ---
3 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
5 # Filename: bin/sde-list-download
6 # Copyright (C) 2007 - 2008 The OpenSDE Project
8 # More information can be found in the files COPYING and README.
10 # This program is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; version 2 of the License. A copy of the
13 # GNU General Public License can be found in the file COPYING.
14 # --- SDE-COPYRIGHT-NOTE-END ---
17 export SDEROOT
=$
( cd "${0%/*}/.."; pwd -P )
19 .
$SDEROOT/lib
/libsde.
in
22 local progname
=${0##*/}
24 Usage: $progname [--cfg <config>] [-erkl] [ITEMS...]
29 longopts
='cfg:,extenders,repositories,package,checksum,location'
30 options
=$
( getopt
-o "$shortopts" -l "$longopts" -- "$@" )
36 # load new arguments list
37 eval set -- "$options"
47 while [ $# -gt 0 ]; do
51 -c|
--cfg) shift; config
="$1" ;;
58 -p|
--package) want_package
=yes ;;
59 -k|
--checksum) want_checksum
=yes ;;
60 -l|
--location) want_location
=yes ;;
65 # TODO: target/$target/download.txt
67 $SDEROOT/bin
/sde-list-pkg
${config:+-c $config} ${extenders:+-e} ${repositories:+-r} -- "$@" |
while read descfile
; do
68 pkg
=$
( echo "$descfile" | cut
-d/ -f3 )
69 grep '^\[D\]' $SDEROOT/$descfile |
while read x
cksum gzfile location
; do
73 [ -z "$want_package" ] || output
="$pkg"
76 [ -z "$want_checksum" ] || output
="${output:+$output\t}$cksum"
80 if [ "$location" != "${location#-}" ]; then
82 location
="${location#-}"
87 bz2file
=$
( echo "$gzfile" |
sed -e 's,\.gpg$,,' -e 's,\.\(t\?\)\(gz\|Z\)$,.\1bz2,' -e 's,\.tar$,.tar.bz2,' )
88 output
="${output:+$output\t}download/$mirror/${bz2file:0:1}/$bz2file"
91 if [ -n "$want_location" ]; then
92 if [ "$location" != "${location#!}" ]; then
94 source="${location#!}"
95 elif [ "$location" = "${location% *}" -a "$location" != "${location%/}" ]; then
96 # no spaces, and trailing '/', append gzfile
97 source="${location}${gzfile}"
101 output
="$output\t$source"