forked from OpenELEC/OpenELEC.tv
/
get
executable file
·80 lines (63 loc) · 2.43 KB
/
get
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/bash
################################################################################
# This file is part of OpenELEC - http://www.openelec.tv
# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv)
#
# OpenELEC is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# OpenELEC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>.
################################################################################
. config/options $1
if [ -z "$1" ]; then
for i in `find packages/ -type f -name package.mk`; do
GET_PKG=`grep ^PKG_NAME= $i | sed -e "s,\",,g" -e "s,PKG_NAME=,,"`
$SCRIPTS/get $GET_PKG
done
for i in `find packages/ -type f -name meta`; do
GET_PKG=`grep ^PKG_NAME= $i | sed -e "s,\",,g" -e "s,PKG_NAME=,,"`
$SCRIPTS/get $GET_PKG
done
fi
[ -z "$PKG_URL" ] && exit 0
if [ -n "$PKG_URL" ]; then
URLS="$URLS `echo $PKG_URL | sed s%GEEXBOX_SRCS%$GEEXBOX_SRCS%`"
for i in $URLS; do
SOURCE_NAME="`basename $i`"
PACKAGE="$SOURCES/$1/$SOURCE_NAME"
PACKAGE_MIRROR="$DISTRO_MIRROR/$PKG_NAME/$SOURCE_NAME"
[ "$VERBOSE" != "yes" ] && WGET_OPT=-q
WGET_CMD="wget --passive-ftp --no-check-certificate -c $WGET_OPT -P $SOURCES/$1"
NBWGET="1"
STAMP="$PACKAGE.url"
MD5SUM="$PACKAGE.md5"
mkdir -p $SOURCES/$1
if [ -f "$STAMP" ]; then
[ `cat $STAMP` = "$i" ] && continue
fi
DL="yes"
$SCRIPTS/checkdeps get
rm -f $STAMP
printf "%${BUILD_INDENT}c ${boldcyan}GET${endcolor} $1\n" ' '>&$SILENT_OUT
export BUILD_INDENT=$((${BUILD_INDENT:-1}+$BUILD_INDENT_SIZE))
until [ -f "$STAMP" ] || $WGET_CMD $i || $WGET_CMD $PACKAGE_MIRROR; do
NBWGET=$(($NBWGET+1))
if [ "$NBWGET" -gt "10" ]; then
echo -e "\nCant't get $1 sources : $i\n Try later !!"
exit 1
fi
done
echo $i > $STAMP
md5sum -t $PACKAGE > $MD5SUM
rm -f $BUILD_BASE*/$STAMPS_NOARCH/$1/unpack
rm -f $BUILD_BASE*/$STAMPS_NOARCH/$1/build
done
fi