-
Notifications
You must be signed in to change notification settings - Fork 13
/
pkg_src_fetch
executable file
·45 lines (36 loc) · 980 Bytes
/
pkg_src_fetch
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
#!/bin/bash
TMPFILE=/tmp/fetchsrclog.$$
function checkpkg {
local rc
rc=0
while [ "$1" ]; do
pkg=$(basename $1)
PKGDIR=""
[ -d "/var/lib/build/staging/$pkg" ] && PKGDIR="/var/lib/build/staging/$pkg"
[ -d "/var/lib/build/all/$pkg" ] && PKGDIR="/var/lib/build/all/$pkg"
if [ -z "$PKGDIR" ]; then
echo "/var/lib/build/all/$pkg does not exist"
rc=1
fi
shift
done
return $rc
}
checkpkg $@ || exit 1
while [ "$1" ]; do
pkg=$(basename $1)
shift
PKGDIR=""
[ -d "/var/lib/build/staging/$pkg" ] && export PKGDIR="/var/lib/build/staging/$pkg"
[ -d "/var/lib/build/all/$pkg" ] && export PKGDIR="/var/lib/build/all/$pkg"
if [ "$PKGDIR" ] && [ -f "$PKGDIR/Fetch-source.sh" ]; then
echo "Fetching $pkg .. "
if ! (cd $PKGDIR; PATH="/var/lib/build:$PATH" "./Fetch-source.sh" &> $TMPFILE); then
echo "## Failed to fetch source for $pkg!"
echo
cat $TMPFILE
echo
fi
fi
done
rm -f $TMPFILE