mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-29 13:46:49 +00:00
package cache: initialise with a function
This commit is contained in:
parent
bf71ef864b
commit
64156ea8c8
@ -515,6 +515,28 @@ enable_service () {
|
||||
done
|
||||
}
|
||||
|
||||
init_package_cache() {
|
||||
local _ANCHOR="@?+?@" DIR
|
||||
|
||||
# If the package caches are unset, then populate them
|
||||
if [ -z "${_CACHE_PACKAGE_LOCAL+x}" -o -z "${_CACHE_PACKAGE_GLOBAL+x}" ]; then
|
||||
_CACHE_PACKAGE_LOCAL=""
|
||||
_CACHE_PACKAGE_GLOBAL=""
|
||||
|
||||
# cache project folder for a package
|
||||
for DIR in $(find $ROOT/projects/$PROJECT/packages -type d 2>/dev/null); do
|
||||
[ -r "$DIR/package.mk" ] && _CACHE_PACKAGE_LOCAL+="${DIR}${_ANCHOR}\n"
|
||||
done
|
||||
|
||||
# cache packages folder
|
||||
for DIR in $(find $ROOT/$PACKAGES -type d 2>/dev/null); do
|
||||
[ -r "$DIR/package.mk" ] && _CACHE_PACKAGE_GLOBAL+="${DIR}${_ANCHOR}\n"
|
||||
done
|
||||
|
||||
export _CACHE_PACKAGE_LOCAL _CACHE_PACKAGE_GLOBAL
|
||||
fi
|
||||
}
|
||||
|
||||
check_path() {
|
||||
dashes="==========================="
|
||||
if [ "${PWD##/usr}" != "${PWD}" ]; then
|
||||
|
21
config/path
21
config/path
@ -53,6 +53,9 @@ SED="sed -i"
|
||||
|
||||
unset LD_LIBRARY_PATH
|
||||
|
||||
# If the package caches are unset, then populate them
|
||||
init_package_cache
|
||||
|
||||
# set package metadata
|
||||
reset_pkg_vars "$1"
|
||||
|
||||
@ -63,24 +66,6 @@ unset LD_LIBRARY_PATH
|
||||
_ANCHOR="@?+?@"
|
||||
PKG_DIR=""
|
||||
|
||||
# If the package caches are unset, then populate them
|
||||
if [ -z "${_CACHE_PACKAGE_LOCAL+x}" -o -z "${_CACHE_PACKAGE_GLOBAL+x}" ]; then
|
||||
_CACHE_PACKAGE_LOCAL=""
|
||||
_CACHE_PACKAGE_GLOBAL=""
|
||||
|
||||
# cache project folder for a package
|
||||
for DIR in $(find $ROOT/projects/$PROJECT/packages -type d 2>/dev/null); do
|
||||
[ -r "$DIR/package.mk" ] && _CACHE_PACKAGE_LOCAL+="${DIR}${_ANCHOR}\n"
|
||||
done
|
||||
|
||||
# cache packages folder
|
||||
for DIR in $(find $ROOT/$PACKAGES -type d 2>/dev/null); do
|
||||
[ -r "$DIR/package.mk" ] && _CACHE_PACKAGE_GLOBAL+="${DIR}${_ANCHOR}\n"
|
||||
done
|
||||
|
||||
export _CACHE_PACKAGE_LOCAL _CACHE_PACKAGE_GLOBAL
|
||||
fi
|
||||
|
||||
# Check for any available local package in preference to a global package
|
||||
for DIR in $(echo -e "${_CACHE_PACKAGE_LOCAL}" | grep -F "/${_PKG_ROOT_NAME}${_ANCHOR}"); do
|
||||
DIR="${DIR%${_ANCHOR}}"
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
unset _CACHE_PACKAGE_LOCAL _CACHE_PACKAGE_GLOBAL
|
||||
|
||||
. config/options TRIGGER_POPULATION_OF_CACHE_PACKAGE
|
||||
. config/options ""
|
||||
|
||||
. config/show_config
|
||||
show_config
|
||||
|
Loading…
x
Reference in New Issue
Block a user