2022-02-25 16:03:42 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
2022-06-07 19:33:55 +08:00
|
|
|
# This is important in order to provide enough locked memory to dragonfly
|
|
|
|
# when running on kernels < 5.12.
|
|
|
|
# This line should reside before `set -e` so it could fail silently
|
|
|
|
# in case the container runs in non-privileged mode.
|
|
|
|
ulimit -l 65000 2> /dev/null
|
|
|
|
|
2022-02-25 16:03:42 +08:00
|
|
|
set -e
|
|
|
|
|
2022-04-08 13:54:53 +08:00
|
|
|
# first arg is `-some-option`
|
2022-02-25 16:03:42 +08:00
|
|
|
if [ "${1#-}" != "$1" ]; then
|
2022-04-08 13:54:53 +08:00
|
|
|
# override arguments by prepending "dragonfly --logtostderr" to them.
|
|
|
|
set -- dragonfly --logtostderr "$@"
|
2022-02-25 16:03:42 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
# allow the docker container to be started with `--user`
|
|
|
|
if [ "$1" = 'dragonfly' -a "$(id -u)" = '0' ]; then
|
|
|
|
exec su-exec dfly "$0" "$@" # runs this script under user dfly
|
|
|
|
fi
|
|
|
|
|
|
|
|
exec "$@"
|