mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-24 11:16:51 +00:00
config/functions: relocate pkg_call functions
This commit is contained in:
parent
c419751278
commit
442b489c99
@ -10,24 +10,6 @@ die() {
|
||||
exit "${2:-1}"
|
||||
}
|
||||
|
||||
# p1: name of potential function to execute if it exists
|
||||
# return 0 if function executed, 1 if not, die if error
|
||||
pkg_call() {
|
||||
[ -n "${PKG_NAME}" ] || die "$(print_color CLR_ERROR "FAILURE: Cannot call ${1} package function when package is not known!")"
|
||||
|
||||
if [ "$(type -t ${1})" = "function" ]; then
|
||||
${1} || die "$(print_color CLR_ERROR "FAILURE: ${1} for package ${PKG_NAME} did not succeed!")"
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# p1: name of potential function to execute if it exists
|
||||
# return 0 if function executed or not, or die if error
|
||||
pkg_call_optional() {
|
||||
pkg_call ${1} || return 0
|
||||
}
|
||||
|
||||
# return 0 if $2 in space-separated list $1, otherwise return 1
|
||||
listcontains() {
|
||||
if [ -n "$1" -a -n "$2" ]; then
|
||||
@ -803,6 +785,24 @@ find_dir_path() {
|
||||
find_path -d "$1" "$2"
|
||||
}
|
||||
|
||||
# p1: name of potential function to execute if it exists
|
||||
# return 0 if function executed, 1 if not, die if error
|
||||
pkg_call() {
|
||||
[ -n "${PKG_NAME}" ] || die "$(print_color CLR_ERROR "FAILURE: Cannot call ${1} package function when package is not known!")"
|
||||
|
||||
if [ "$(type -t ${1})" = "function" ]; then
|
||||
${1} || die "$(print_color CLR_ERROR "FAILURE: ${1} for package ${PKG_NAME} did not succeed!")"
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# p1: name of potential function to execute if it exists
|
||||
# return 0 if function executed or not, or die if error
|
||||
pkg_call_optional() {
|
||||
pkg_call ${1} || return 0
|
||||
}
|
||||
|
||||
|
||||
### KERNEL HELPERS ###
|
||||
kernel_path() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user