mirror of
https://github.com/craigerl/aprsd.git
synced 2024-10-18 17:50:18 -04:00
Hemna
f02db20c3e
this patch changes the entrypoint and commands to be in line with how Docker defines their usage. this allows the admin using this container to specify which command to run in the docker-compose.yml if they want to run something other than the aprsd server command. This now allows to easily run webchat as a container :)!
51 lines
1.3 KiB
Bash
Executable File
51 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -x
|
|
|
|
# The default command
|
|
# Override the command in docker-compose.yml to change
|
|
# what command you want to run in the container
|
|
COMMAND="server"
|
|
|
|
if [ ! -z "$@" ]; then
|
|
COMMAND=$@
|
|
fi
|
|
|
|
if [ ! -z "${APRSD_PLUGINS}" ]; then
|
|
OLDIFS=$IFS
|
|
IFS=','
|
|
echo "Installing pypi plugins '$APRSD_PLUGINS'";
|
|
for plugin in ${APRSD_PLUGINS}; do
|
|
IFS=$OLDIFS
|
|
# call your procedure/other scripts here below
|
|
echo "Installing '$plugin'"
|
|
pip3 install --user $plugin
|
|
done
|
|
fi
|
|
|
|
if [ ! -z "${APRSD_EXTENSIONS}" ]; then
|
|
OLDIFS=$IFS
|
|
IFS=','
|
|
echo "Installing APRSD extensions from pypi '$APRSD_EXTENSIONS'";
|
|
for extension in ${APRSD_EXTENSIONS}; do
|
|
IFS=$OLDIFS
|
|
# call your procedure/other scripts here below
|
|
echo "Installing '$extension'"
|
|
pip3 install --user $extension
|
|
done
|
|
fi
|
|
|
|
if [ -z "${LOG_LEVEL}" ] || [[ ! "${LOG_LEVEL}" =~ ^(CRITICAL|ERROR|WARNING|INFO)$ ]]; then
|
|
LOG_LEVEL="DEBUG"
|
|
fi
|
|
|
|
echo "Log level is set to ${LOG_LEVEL}";
|
|
|
|
# check to see if there is a config file
|
|
APRSD_CONFIG="/config/aprsd.conf"
|
|
if [ ! -e "$APRSD_CONFIG" ]; then
|
|
echo "'$APRSD_CONFIG' File does not exist. Creating."
|
|
aprsd sample-config > $APRSD_CONFIG
|
|
fi
|
|
|
|
exec aprsd "${COMMAND}" --config ${APRSD_CONFIG} --loglevel ${LOG_LEVEL}
|