diff --git a/rootfs/usr/local/bin/entrypoint.sh b/rootfs/usr/local/bin/entrypoint.sh index 62e4944..8007026 100755 --- a/rootfs/usr/local/bin/entrypoint.sh +++ b/rootfs/usr/local/bin/entrypoint.sh @@ -52,6 +52,7 @@ for set_env in "/root/env.sh" "/usr/local/etc/docker/env"/*.sh "/config/env"/*.s done # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Builtin functions +__is_dir_empty() { [ "$(ls -A "$1" 2>/dev/null | wc -l)" -ne 0 ] && return 0 || return 1; } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Custom functions diff --git a/rootfs/usr/local/etc/docker/functions/entrypoint.sh b/rootfs/usr/local/etc/docker/functions/entrypoint.sh index df0771c..5603c34 100644 --- a/rootfs/usr/local/etc/docker/functions/entrypoint.sh +++ b/rootfs/usr/local/etc/docker/functions/entrypoint.sh @@ -32,9 +32,9 @@ __cd() { [ -d "$1" ] && builtin cd "$1" || return 1; } __rm() { [ -n "$1" ] && [ -e "$1" ] && rm -Rf "${1:?}"; } __grep_test() { grep -s "$1" "$2" | grep -qwF "${3:-$1}" || return 1; } __netstat() { [ -f "$(type -P netstat)" ] && netstat "$@" || return 10; } -__is_dir_empty() { [ "$(ls -A "$1" 2>/dev/null | wc -l)" -eq 0 ] || return 1; } __curl() { curl -q -sfI --max-time 3 -k -o /dev/null "$@" &>/dev/null || return 10; } __find() { find "$1" -mindepth 1 -type ${2:-f,d} 2>/dev/null | grep '^' || return 10; } +__is_dir_empty() { [ "$(ls -A "$1" 2>/dev/null | wc -l)" -ne 0 ] && return 0 || return 1; } __pcheck() { [ -n "$(which pgrep 2>/dev/null)" ] && pgrep -o "$1" &>/dev/null || return 10; } __sed() { sed -i 's|'$1'|'$2'|g' "$3" &>/dev/null || sed -i "s|$1|$2|g" "$3" &>/dev/null || return 1; } __ps() { [ -f "$(type -P ps)" ] && ps "$@" 2>/dev/null | grep -Fw " ${1:-$GEN_SCRIPT_REPLACE_APPNAME}" || return 10; }