andrius-asterisk/debian-stretch-slim-16-current/docker-entrypoint.sh
2018-10-11 10:16:02 +02:00

25 lines
748 B
Bash
Executable File

#!/bin/sh
# run as user asterisk by default
ASTERISK_USER=${ASTERISK_USER:-asterisk}
if [ "$1" = "" ]; then
COMMAND="/usr/sbin/asterisk -T -W -U ${ASTERISK_USER} -p -vvvdddf"
else
COMMAND="$@"
fi
if [ "${ASTERISK_UID}" != "" ] && [ "${ASTERISK_GID}" != "" ]; then
# recreate user and group for asterisk
# if they've sent as env variables (i.e. to macth with host user to fix permissions for mounted folders
deluser asterisk && \
adduser --gecos "" --no-create-home --uid ${ASTERISK_UID} --disabled-password ${ASTERISK_USER} || exit
chown -R ${ASTERISK_UID}:${ASTERISK_UID} /etc/asterisk \
/var/*/asterisk \
/usr/*/asterisk
fi
exec ${COMMAND}