mirror of
https://github.com/casjaysdevdocker/cherokee
synced 2025-01-18 12:34:38 -05:00
46 lines
2.5 KiB
Bash
Executable File
46 lines
2.5 KiB
Bash
Executable File
#!/usr/bin/env sh
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
# Set bash options
|
|
[ -n "$DEBUG" ] && set -x
|
|
set -o pipefail
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
export PATH="/usr/local/share/cherokee/bin:/usr/local/share/cherokee/sbin:$PATH"
|
|
[ -f "/config/ssl.env" ] && . "/config/ssl.env"
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
if [ ! -d "/config/cherokee" ] && [ -d "/usr/local/share/template-files/config/cherokee" ]; then
|
|
mkdir -p "/config/cherokee"
|
|
cp -Rf "/usr/local/share/template-files/config/cherokee/." "/config/cherokee/"
|
|
fi
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
[ -d "/data/cherokee/graphs" ] || mkdir -p "/data/cherokee/graphs"
|
|
[ -d "/config/cherokee" ] && cp -Rf "/config/cherokee/." "/etc/cherokee/" || cp -Rf "/usr/local/share/template-files/config/defaults/" "/etc/cherokee/"
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
[ -d "/data/htdocs" ] || mkdir -p "/data/htdocs"
|
|
[ -d "/data/cherokee" ] || mkdir -p "/data/cherokee"
|
|
[ -d "/config/cherokee/themes" ] && cp -Rf "/config/cherokee/themes/." "/usr/local/share/cherokee/share/cherokee/themes/"
|
|
if [ -z "$(ls -A /data/htdocs/www/* 2>/dev/null||echo '')" ]; then
|
|
mkdir -p "/data/htdocs" "/data/htdocs/cgi-bin"
|
|
cp -Rf "/usr/local/share/template-files/data/." "/data/"
|
|
fi
|
|
[ -d "/usr/lib/cgi-bin" ] && [ -d "" ] && cp -Rf "/usr/lib/cgi-bin/." "/data/htdocs/cgi-bin/"
|
|
[ -f "/config/cherokee/cherokee.conf" ] && cp -Rfv "/config/cherokee/cherokee.conf" "/etc/cherokee/"
|
|
[ -d "/usr/local/share/cherokee/icons" ] && [ ! -d "/config/cherokee/icons" ] && cp -Rf "/usr/local/share/cherokee/icons/." "/config/cherokee/icons/"
|
|
[ -d "/usr/local/share/cherokee/themes" ] && [ ! -d "/config/cherokee/themes" ] && cp -Rf "/usr/local/share/cherokee/themes/." "/config/cherokee/themes/"
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
if [ ! -f "/config/ssl//localhost.crt" ] || [ ! -f "/config/ssl//localhost.key" ]; then
|
|
create-ssl-cert
|
|
fi
|
|
# Fix permissions
|
|
chmod -Rfv 664 "/data/cherokee"
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
# Start php-fpm server
|
|
php-fpm-server &
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
if [ ! -f "/tmp/cherokee.pid" ]; then
|
|
echo "Starting cherokee-admin on port 9090"
|
|
cherokee-admin -b -p 9090 -C /etc/cherokee/cherokee.conf &
|
|
echo "Starting cherokee webserver on port 80"
|
|
exec cherokee -C /etc/cherokee/cherokee.conf || rm -Rf "/tmp/cherokee.pid"
|
|
fi
|
|
|