mirror of
https://github.com/casjaysdevdocker/aria2
synced 2026-08-09 08:01:30 -04:00
aria2 / release-aria2 (push) Failing after 1m48s
- rootfs/usr/local/bin/entrypoint.sh:
1. The "start all services" gate
(`if [ "$START_SERVICES" = "yes" ] || [ -z "$1" ]`) always evaluated
true on a first-run container regardless of $1, because
START_SERVICES is force-set to "yes" whenever no PID file exists yet.
Any command passed to `docker run` — `exec ...`, `sh -c ...`,
`shell`, or an arbitrary program — was swallowed into the
service-start+monitor branch before reaching the `case "$1"`
statement that already handles those subcommands, hanging the
container as a daemon instead of running the given command. Changed
the condition to `if [ -z "$1" ]` so the daemon branch only fires
when no command was given at all.
2. The `*/bin/sh | */bin/bash | bash | sh | shell)` case branch
unconditionally shifted $1 before `__exec_command "$@"` (a bare
`exec "$@"`). For `docker run image sh -c 'cmd'` this turned the
exec into `exec -c cmd` (command not found, exit 127) instead of
`exec sh -c 'cmd'`. Split the branch: real interpreter names
(*/bin/sh, */bin/bash, bash, sh) now pass through unshifted; the
"shell" keyword (not a real interpreter) gets its own branch that
shifts and prepends "sh" to any remaining args, or falls back to a
bare `__exec_command` (exec bash -l) when none remain.
Verified `bash -n` passes. Found and fixed upstream in
dockersrc/go, confirmed identical in this repo's generated
entrypoint.sh, and mechanically applied here with the same patch.
78 lines
2.6 KiB
Bash
Executable File
78 lines
2.6 KiB
Bash
Executable File
#!/usr/bin/env sh
|
|
# shellcheck shell=sh
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
##@Version : 202605051306-git
|
|
# @@Author : Jason Hempstead
|
|
# @@Contact : jason@casjaysdev.pro
|
|
# @@License : WTFPL
|
|
# @@ReadME : symlink --help
|
|
# @@Copyright : Copyright: (c) 2026 Jason Hempstead, Casjays Developments
|
|
# @@Created : Tuesday, May 05, 2026 13:06 EDT
|
|
# @@File : symlink
|
|
# @@Description :
|
|
# @@Changelog : New script
|
|
# @@TODO : Better documentation
|
|
# @@Other :
|
|
# @@Resource :
|
|
# @@Terminal App : no
|
|
# @@sudo/root : no
|
|
# @@Template : shell/sh
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
# shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2090,SC2115,SC2120,SC2155,SC2199,SC2229,SC2317,SC2329
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
APPNAME="$(basename -- "$0" 2>/dev/null)"
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
# colorization
|
|
if [ -n "$NO_COLOR" ]; then
|
|
__printf_color() { printf '%b' "$1\n" | tr -d '\t' | sed '/^%b$/d;s,\x1B\[ 0-9;]*[a-zA-Z],,g'; }
|
|
else
|
|
__printf_color() { { [ -z "$2" ] || DEFAULT_COLOR=$2; } && printf "%b" "$(tput setaf "$DEFAULT_COLOR" 2>/dev/null)" "$1\n" "$(tput sgr0 2>/dev/null)"; }
|
|
fi
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
__unlink() { [ -L "$1" ] && rm -f -- "$1" >/dev/null; }
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
# custom functions
|
|
__ln_sf() {
|
|
exitCode=0
|
|
if [ -d "$1" ] && [ ! -L "$1" ]; then
|
|
__printf_color "symlinking contents of $1 into $2/" "4"
|
|
__unlink "$2"
|
|
mkdir -p "$2"
|
|
for f in "$1"/* "$1"/.[!.]* "$1"/..?*; do
|
|
[ -e "$f" ] || [ -L "$f" ] || continue
|
|
base=$(basename -- "$f")
|
|
__ln_sf "$f" "$2/$base" || exitCode=$?
|
|
done
|
|
else
|
|
__printf_color "symlinking $2 to $1" "4"
|
|
__unlink "$2"
|
|
ln -sf "$1" "$2"
|
|
exitCode=$?
|
|
fi
|
|
return $exitCode
|
|
}
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
# Define variables
|
|
DEFAULT_COLOR="254"
|
|
SYMLINK_EXIT_STATUS=0
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
# Main application
|
|
if [ $# -ne 2 ]; then
|
|
__printf_color "USAGE: $APPNAME from to" "2" >&2
|
|
SYMLINK_EXIT_STATUS=1
|
|
elif [ ! -e "$1" ]; then
|
|
__printf_color "$1 does not exist" >&2
|
|
SYMLINK_EXIT_STATUS=2
|
|
else
|
|
__ln_sf "$1" "$2" >/dev/null
|
|
SYMLINK_EXIT_STATUS=$?
|
|
fi
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
# End application
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
# lets exit with code
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
exit $SYMLINK_EXIT_STATUS
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
# ex: ts=2 sw=2 et filetype=sh
|