mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-28 13:16:41 +00:00
Avoid concurrent downloads of the same package
This commit is contained in:
parent
9721c185b5
commit
6129eff668
12
scripts/get
12
scripts/get
@ -28,6 +28,16 @@ if [ -z "$1" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$PKG_URL" ]; then
|
if [ -n "$PKG_URL" ]; then
|
||||||
|
mkdir -p $SOURCES/$1
|
||||||
|
|
||||||
|
# Avoid concurrent downloads of the same package
|
||||||
|
_isblocked=N
|
||||||
|
exec 99>$SOURCES/$1/.lock
|
||||||
|
while ! flock --nonblock --exclusive 99; do
|
||||||
|
[ ${_isblocked} == N ] && { echo "Project ${PROJECT} waiting to avoid concurrent download of ${1}..."; _isblocked=Y; }
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
for i in $PKG_URL; do
|
for i in $PKG_URL; do
|
||||||
SOURCE_NAME="`basename $i`"
|
SOURCE_NAME="`basename $i`"
|
||||||
PACKAGE="$SOURCES/$1/$SOURCE_NAME"
|
PACKAGE="$SOURCES/$1/$SOURCE_NAME"
|
||||||
@ -40,8 +50,6 @@ if [ -n "$PKG_URL" ]; then
|
|||||||
STAMP="$PACKAGE.url"
|
STAMP="$PACKAGE.url"
|
||||||
MD5SUM="$PACKAGE.md5"
|
MD5SUM="$PACKAGE.md5"
|
||||||
|
|
||||||
mkdir -p $SOURCES/$1
|
|
||||||
|
|
||||||
if [ -f "$STAMP" ]; then
|
if [ -f "$STAMP" ]; then
|
||||||
[ "`cat $STAMP`" = "$i" ] && continue
|
[ "`cat $STAMP`" = "$i" ] && continue
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user