1
0
mirror of https://github.com/gilbN/theme.park.git synced 2024-08-17 15:39:36 +02:00
theme.park/docker/root/etc/cont-init.d/50-config
2022-03-29 21:33:17 +02:00

67 lines
1.6 KiB
Plaintext

#!/usr/bin/with-contenv bash
echo '------------------'
echo '| theme.park |'
echo '------------------'
# Display variables for troubleshooting
echo -e "Variables set:\\n\
PUID=${PUID}\\n\
PGID=${PGID}\\n\
TZ=${TZ}\\n\
TP_SCHEME=${TP_SCHEME}\\n\
TP_URLBASE=${TP_URLBASE}\\n\
TP_DOMAIN=${TP_DOMAIN}\\n"
if [[ -z ${TP_DOMAIN} ]]; then
echo 'No domain set, defaulting to $http_host'
TP_DOMAIN='$http_host'
fi
if [[ -z ${TP_SCHEME} ]]; then
echo 'No scheme set, defaulting to https'
TP_SCHEME='https'
fi
if [[ -z ${TP_URLBASE} ]]; then
TP_URLBASE=''
fi
# Remove forward slash
case ${TP_URLBASE} in
*"/"*)
TP_URLBASE=$(echo "${TP_URLBASE}" | sed 's/\///g')
;;
esac
DEFAULT='/defaults/default'
if [[ ${TP_URLBASE} ]]; then
echo "seding location"
sed -i "s/location \//location \/${TP_URLBASE}/g" ${DEFAULT}
echo "seding TP_DOMAIN"
sed -i "s/TP_DOMAIN/${TP_DOMAIN}/g" ${DEFAULT}
sed -i "s/TP_URLBASE/${TP_URLBASE}/g" ${DEFAULT}
sed -i "s/#sub_filter/sub_filter/g" ${DEFAULT}
sed -i "s/#location#/location /g" ${DEFAULT}
elif [[ -z ${TP_URLBASE} ]]; then
sed -i "s/TP_DOMAIN\/TP_URLBASE/${TP_DOMAIN}/g" ${DEFAULT}
fi
cp /defaults/default /config/nginx/site-confs
# make our folders and links
mkdir -p \
/config/www/{css,resources}
# copy theme files
cp -R /app/themepark/css /config/www
cp -R /app/themepark/resources /config/www
cp /app/themepark/index.html /config/www
cp /app/themepark/themes.py /config/www
cp /app/themepark/CNAME /config/www
echo 'Creating CSS files'
python3 /config/www/themes.py
# permissions
chown -R abc:abc \
/config