2023-04-22 08:19:45 -07:00
|
|
|
#!/bin/bash
|
|
|
|
source /opt/core_run.env
|
2024-01-14 14:57:09 -08:00
|
|
|
|
2024-01-29 15:11:57 -08:00
|
|
|
cmd=$1
|
|
|
|
|
|
|
|
# [[ $DEVELOPMENT && $cmd == "${ENTRYPOINT_CMD:-start}" ]] && echo "development mode enabled, idling container" && cmd=idle
|
|
|
|
|
|
|
|
case "$cmd" in
|
2024-01-14 14:57:09 -08:00
|
|
|
|
2023-04-22 08:19:45 -07:00
|
|
|
maphostid)
|
|
|
|
shift 1
|
2024-01-29 15:11:57 -08:00
|
|
|
/bin/bash -l -c '$:LIB_DIR/map-host-id $@' $0 "$@"
|
2023-04-22 08:19:45 -07:00
|
|
|
;;
|
2024-01-14 14:57:09 -08:00
|
|
|
idle)
|
2024-01-29 15:11:57 -08:00
|
|
|
echo container put in idle mode, use docker terminal to access
|
2024-01-14 14:57:09 -08:00
|
|
|
sleep infinity
|
|
|
|
;;
|
2023-04-22 08:19:45 -07:00
|
|
|
image)
|
|
|
|
shift 1
|
2024-01-29 15:11:57 -08:00
|
|
|
/bin/bash -l -c '$LIB_DIR/image-info $@' $0 "$@"
|
2023-04-22 08:19:45 -07:00
|
|
|
;;
|
|
|
|
shell)
|
|
|
|
shift 1
|
|
|
|
_shell_=/bin/bash
|
|
|
|
[[ $1 ]] && _shell_="/bin/su $1"
|
2024-01-14 14:57:09 -08:00
|
|
|
$_shell_ -c "cd ${DEFAULT_DIR:-/}; exec bash -l"
|
2023-04-22 08:19:45 -07:00
|
|
|
;;
|
|
|
|
help)
|
|
|
|
$BIN_DIR/entrypoint-help
|
|
|
|
;;
|
|
|
|
script)
|
|
|
|
shift 1
|
|
|
|
cat | /bin/bash -l
|
|
|
|
;;
|
|
|
|
${ENTRYPOINT_CMD:-start})
|
|
|
|
shift 1
|
2024-01-29 15:11:57 -08:00
|
|
|
/bin/bash -l -c '${ENTRYPOINT_CMD_PATH:-$BIN_DIR/${ENTRYPOINT_CMD:-start}} $@' $0 "$@"
|
2023-04-22 08:19:45 -07:00
|
|
|
;;
|
|
|
|
*)
|
2023-04-22 10:22:50 -07:00
|
|
|
echo "--- command passed to container: $* ---"
|
|
|
|
echo -e "output:\n"
|
2023-04-22 08:19:45 -07:00
|
|
|
if [ -n "$*" ]; then
|
|
|
|
if ! /bin/bash -l -c '$@' $0 "$@" ; then
|
|
|
|
$BIN_DIR/entrypoint-help
|
|
|
|
fi
|
2023-04-22 10:22:50 -07:00
|
|
|
echo -e "\n------------------------------\n"
|
2023-04-22 08:19:45 -07:00
|
|
|
else
|
2023-04-22 10:22:50 -07:00
|
|
|
echo "!!!! no command was passed to entrypoint !!!! "
|
2023-04-22 08:19:45 -07:00
|
|
|
echo
|
|
|
|
$BIN_DIR/entrypoint-help
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|