mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-22 13:03:16 +00:00
improve naming of directory-is-empty
This commit is contained in:
parent
d372b9dee7
commit
8189b01a26
2 changed files with 4 additions and 3 deletions
|
@ -31,7 +31,7 @@ IFS=' ' read -ar skip_scripts <<< "$ENTRYPOINT_SKIP_SCRIPTS"
|
|||
mkdir -p "${ENTRYPOINT_D_ROOT}"
|
||||
|
||||
# If ENTRYPOINT_D_ROOT directory is empty, warn and run the regular command
|
||||
if is-directory-empty "${ENTRYPOINT_D_ROOT}"; then
|
||||
if directory-is-empty "${ENTRYPOINT_D_ROOT}"; then
|
||||
log-warning "No files found in ${ENTRYPOINT_D_ROOT}, skipping configuration"
|
||||
|
||||
exec "$@"
|
||||
|
|
|
@ -317,13 +317,14 @@ function file-exists()
|
|||
{
|
||||
[[ -f "$1" ]]
|
||||
}
|
||||
|
||||
# @description Checks if $1 contains any files or not
|
||||
# @arg $1 string The path to check
|
||||
# @exitcode 0 If $1 contains files
|
||||
# @exitcode 1 If $1 does *NOT* contain files
|
||||
function is-directory-empty()
|
||||
function directory-is-empty()
|
||||
{
|
||||
! find "${1}" -mindepth 1 -maxdepth 1 -type f -print -quit 2> /dev/null | read -r
|
||||
[ -z "$(ls -A "${1}")" ]
|
||||
}
|
||||
|
||||
# @description Ensures a directory exists (via mkdir)
|
||||
|
|
Loading…
Reference in a new issue