This commit is contained in:
Josh 2020-05-27 00:16:23 -04:00
parent 82c8d62e84
commit 4ba59a84d0

87
init.sh
View file

@ -8,152 +8,123 @@ LOG_FILE=${LOG_FILE:-/var/log/gophernicus.log}
GOPHER_ROOT=${GOPHER_ROOT:-/var/gopher} GOPHER_ROOT=${GOPHER_ROOT:-/var/gopher}
# Arguments # Arguments
if test ${PORT} if [ ${PORT} ]; then
then
SERVER_ARGS="${SERVER_ARGS} -p ${PORT}" SERVER_ARGS="${SERVER_ARGS} -p ${PORT}"
fi fi
if test ${TLS_PORT} if [ ${TLS_PORT} ]; then
then
SERVER_ARGS="${SERVER_ARGS} -T ${TLS_PORT}" SERVER_ARGS="${SERVER_ARGS} -T ${TLS_PORT}"
fi fi
if test ${GOPHER_ROOT} if [ ${GOPHER_ROOT} ]; then
then
SERVER_ARGS="${SERVER_ARGS} -r ${GOPHER_ROOT}" SERVER_ARGS="${SERVER_ARGS} -r ${GOPHER_ROOT}"
fi fi
if test ${DEFAULT_FILE_TYPE} if [ ${DEFAULT_FILE_TYPE} ]; then
then
SERVER_ARGS="${SERVER_ARGS} -t ${DEFAULT_FILE_TYPE}" SERVER_ARGS="${SERVER_ARGS} -t ${DEFAULT_FILE_TYPE}"
fi fi
if test ${GOPHER_MAPFILE} if [ ${GOPHER_MAPFILE} ]; then
then
SERVER_ARGS="${SERVER_ARGS} -g ${GOPHER_MAPFILE}" SERVER_ARGS="${SERVER_ARGS} -g ${GOPHER_MAPFILE}"
fi fi
if test ${GOPHER_TAGFILE} if [ ${GOPHER_TAGFILE} ]; then
then
SERVER_ARGS="${SERVER_ARGS} -a ${GOPHER_TAGFILE}" SERVER_ARGS="${SERVER_ARGS} -a ${GOPHER_TAGFILE}"
fi fi
if test ${CGI_DIR} if [ ${CGI_DIR} ]; then
then
SERVER_ARGS="${SERVER_ARGS} -c ${CGI_DIR}" SERVER_ARGS="${SERVER_ARGS} -c ${CGI_DIR}"
fi fi
if test ${USER_DIR} if [ ${USER_DIR} ]; then
then
SERVER_ARGS="${SERVER_ARGS} -u ${USER_DIR}" SERVER_ARGS="${SERVER_ARGS} -u ${USER_DIR}"
fi fi
if test ${LOG_FILE} if [ ${LOG_FILE} ]; then
then
SERVER_ARGS="${SERVER_ARGS} -l ${LOG_FILE}" SERVER_ARGS="${SERVER_ARGS} -l ${LOG_FILE}"
mkdir -p "$(dirname ${LOG_FILE})" mkdir -p "$(dirname ${LOG_FILE})"
touch "${LOG_FILE}" touch "${LOG_FILE}"
chown nobody.nobody "${LOG_FILE}" chown nobody.nobody "${LOG_FILE}"
fi fi
if test ${DEFAULT_WIDTH} if [ ${DEFAULT_WIDTH} ]; then
then
SERVER_ARGS="${SERVER_ARGS} -w ${DEFAULT_WIDTH}" SERVER_ARGS="${SERVER_ARGS} -w ${DEFAULT_WIDTH}"
fi fi
if test ${DEFAULT_CHARSET} if [ ${DEFAULT_CHARSET} ]; then
then
SERVER_ARGS="${SERVER_ARGS} -o ${DEFAULT_CHARSET}" SERVER_ARGS="${SERVER_ARGS} -o ${DEFAULT_CHARSET}"
fi fi
if test ${SESSION_TIMEOUT} if [ ${SESSION_TIMEOUT} ]; then
then
SERVER_ARGS="${SERVER_ARGS} -s ${SESSION_TIMEOUT}" SERVER_ARGS="${SERVER_ARGS} -s ${SESSION_TIMEOUT}"
fi fi
if test ${MAX_HITS} if [ ${MAX_HITS} ]; then
then
SERVER_ARGS="${SERVER_ARGS} -i ${MAX_HITS}" SERVER_ARGS="${SERVER_ARGS} -i ${MAX_HITS}"
fi fi
if test ${MAX_TRANSFER_KB} if [ ${MAX_TRANSFER_KB} ]; then
then
SERVER_ARGS="${SERVER_ARGS} -k ${MAX_TRANSFER_KB}" SERVER_ARGS="${SERVER_ARGS} -k ${MAX_TRANSFER_KB}"
fi fi
if test ${FILTER_DIR} if [ ${FILTER_DIR} ]; then
then
SERVER_ARGS="${SERVER_ARGS} -f ${FILTER_DIR}" SERVER_ARGS="${SERVER_ARGS} -f ${FILTER_DIR}"
fi fi
# Booleans # Booleans
if test ${DISABLE_VHOSTS} if [ ${DISABLE_VHOSTS} ]; then
then
SERVER_ARGS="${SERVER_ARGS} -nv" SERVER_ARGS="${SERVER_ARGS} -nv"
fi fi
if test ${DISABLE_PARENT_DIR_LINKS} if [ ${DISABLE_PARENT_DIR_LINKS} ]; then
then
SERVER_ARGS="${SERVER_ARGS} -nl" SERVER_ARGS="${SERVER_ARGS} -nl"
fi fi
if test ${DISABLE_HEADER} if [ ${DISABLE_HEADER} ]; then
then
SERVER_ARGS="${SERVER_ARGS} -nh" SERVER_ARGS="${SERVER_ARGS} -nh"
fi fi
if test ${DISABLE_FOOTER} if [ ${DISABLE_FOOTER} ]; then
then
SERVER_ARGS="${SERVER_ARGS} -nf" SERVER_ARGS="${SERVER_ARGS} -nf"
fi fi
if test ${DISABLE_MENU_METADATA} if [ ${DISABLE_MENU_METADATA} ]; then
then
SERVER_ARGS="${SERVER_ARGS} -nd" SERVER_ARGS="${SERVER_ARGS} -nd"
fi fi
if test ${DISABLE_CONTENT_DETECTION} if [ ${DISABLE_CONTENT_DETECTION} ]; then
then
SERVER_ARGS+"${SERVER_ARGS} -nc" SERVER_ARGS+"${SERVER_ARGS} -nc"
fi fi
if test ${DISABLE_CHARSET_CONV} if [ ${DISABLE_CHARSET_CONV} ]; then
then
SERVER_ARGS+"${SERVER_ARGS} -no" SERVER_ARGS+"${SERVER_ARGS} -no"
fi fi
if test ${DISABLE_QUERY_STRINGS} if [ ${DISABLE_QUERY_STRINGS} ]; then
then
SERVER_ARGS+"${SERVER_ARGS} -nq" SERVER_ARGS+"${SERVER_ARGS} -nq"
fi fi
if test ${DISABLE_SYSLOG} if [ ${DISABLE_SYSLOG} ]; then
then
SERVER_ARGS+"${SERVER_ARGS} -ns" SERVER_ARGS+"${SERVER_ARGS} -ns"
fi fi
if test ${DISABLE_AUTOGEN_CAPS} if [ ${DISABLE_AUTOGEN_CAPS} ]; then
then
SERVER_ARGS+"${SERVER_ARGS} -na" SERVER_ARGS+"${SERVER_ARGS} -na"
fi fi
if test ${DISABLE_SERVER_STATUS} if [ ${DISABLE_SERVER_STATUS} ]; then
then
SERVER_ARGS+"${SERVER_ARGS} -nt" SERVER_ARGS+"${SERVER_ARGS} -nt"
fi fi
if test ${DISABLE_HAPROXY} if [ ${DISABLE_HAPROXY} ]; then
then
SERVER_ARGS+"${SERVER_ARGS} -np" SERVER_ARGS+"${SERVER_ARGS} -np"
fi fi
if test ${DISABLE_EXECUTABLES} if [ ${DISABLE_EXECUTABLES} ]; then
then
SERVER_ARGS+"${SERVER_ARGS} -nx" SERVER_ARGS+"${SERVER_ARGS} -nx"
fi fi
if test ${DISABLE_USERDIRS} if [ ${DISABLE_USERDIRS} ]; then
then
SERVER_ARGS+"${SERVER_ARGS} -nu" SERVER_ARGS+"${SERVER_ARGS} -nu"
fi fi