blob: df9c206ba819d82c8bfca0627285dad2610fa46d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
#!/bin/sh
# sbosrcarch client example script. tested with bash, ash, zsh, ksh.
# if you want a fancier client, that's smart enough to try several
# archive sites, plus well-known source archives like gentoo and
# freebsd, plus archive.org's wayback machine, have a look at:
# http://urchlay.naptime.net/repos/sbostuff/plain/sbofindsrc
# path to the root of your archive (contains the by-name and
# by-md5 directories):
ARCHIVE=http://yoursite.com/sbosrc
. $( pwd )/*.info || ( echo "no .info file in current dir" 1>&2 && exit 1 )
if [ "$ARCH" = "x86_64" -a "$MD5SUM_x86_64" != "" ]; then
MD5SUM="$MD5SUM_x86_64"
DOWNLOAD="$DOWNLOAD_x86_64"
fi
set $MD5SUM
for url in $DOWNLOAD; do
file="$( echo "$url" | sed 's,.*/,,' )"
md5=$1
shift
echo "Downloading $file ($md5)"
a=$( echo $md5 | cut -b1 )
b=$( echo $md5 | cut -b2 )
wget -O "$file" "$ARCHIVE/by-md5/$a/$b/$md5/$file"
if [ -e "$file" -a "$( md5sum "$file" | cut -d' ' -f1 )" = "$md5" ]; then
echo "downloaded, md5sum matches"
else
echo "download failed"
fail=1
fi
done
if [ "$fail" != "1" ]; then
echo "All files found and downloaded successfully"
exit 0
else
exit 1
fi
|