Files
Arch-R/scripts/get

73 lines
2.3 KiB
Bash
Executable File

#!/bin/bash
################################################################################
# This file is part of LibreELEC - https://libreelec.tv
# Copyright (C) 2017-present Team LibreELEC
#
# LibreELEC 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.
#
# LibreELEC 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 LibreELEC. 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
fi
# Avoid concurrent processing of the same package
function lock_source_dir() {
local _isblocked=N
exec 99<$SOURCES/$1
while ! flock --nonblock --exclusive 99; do
[ ${_isblocked} == N ] && { echo "Project/Device ${DEVICE:-${PROJECT}} waiting, to avoid concurrent processing of ${1}..."; _isblocked=Y; }
sleep 1
done
}
if [ -n "$PKG_URL" -a -n "$PKG_SOURCE_NAME" ]; then
mkdir -p $SOURCES/$1
PACKAGE="$SOURCES/$1/$PKG_SOURCE_NAME"
STAMP_URL="$PACKAGE.url"
STAMP_SHA="$PACKAGE.sha256"
# determine get handler based on protocol and/or filename
case "${PKG_URL}" in
git://*|*.git)
get_handler="git";;
file://*)
get_handler="file";;
*)
get_handler="archive";;
esac
if ! listcontains "${GET_HANDLER_SUPPORT}" "${get_handler}"; then
echo "ERROR: get handler \"${get_handler}\" is not supported, unable to get package $1 - aborting!"
exit 1
else
get_handler="${SCRIPTS}/get_${get_handler}"
if [ ! -f ${get_handler} ]; then
echo "ERROR: get handler \"${get_handler}\" does not exist, unable to get package $1 - aborting!"
exit 1
else
source ${get_handler}
fi
fi
fi
exit 0