2022-03-20 21:27:28 +01:00
|
|
|
#!/usr/bin/with-contenv bash
|
|
|
|
|
|
|
|
echo '------------------'
|
|
|
|
echo '| theme.park |'
|
|
|
|
echo '------------------'
|
|
|
|
|
|
|
|
# Display variables for troubleshooting
|
|
|
|
echo -e "Variables set:\\n\
|
2022-03-22 10:06:13 +01:00
|
|
|
PUID=${PUID}\\n\
|
|
|
|
PGID=${PGID}\\n\
|
|
|
|
TZ=${TZ}\\n\
|
2022-03-23 18:55:57 +01:00
|
|
|
TP_SCHEME=${TP_SCHEME}\\n\
|
2022-03-29 21:33:56 +02:00
|
|
|
TP_URLBASE=${TP_URLBASE}\\n\
|
2022-03-22 10:06:13 +01:00
|
|
|
TP_DOMAIN=${TP_DOMAIN}\\n"
|
2022-03-20 21:27:28 +01:00
|
|
|
|
|
|
|
if [[ -z ${TP_DOMAIN} ]]; then
|
|
|
|
echo 'No domain set, defaulting to $http_host'
|
|
|
|
TP_DOMAIN='$http_host'
|
|
|
|
fi
|
|
|
|
|
2022-03-26 20:45:05 +01:00
|
|
|
if [[ -z ${TP_SCHEME} ]]; then
|
2022-03-30 22:55:58 +02:00
|
|
|
echo 'No scheme set, defaulting to $scheme'
|
|
|
|
TP_SCHEME='$scheme'
|
2022-03-26 20:45:05 +01:00
|
|
|
fi
|
|
|
|
|
2022-03-29 21:33:56 +02:00
|
|
|
if [[ -z ${TP_URLBASE} ]]; then
|
|
|
|
TP_URLBASE=''
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Remove forward slash
|
|
|
|
case ${TP_URLBASE} in
|
|
|
|
*"/"*)
|
|
|
|
TP_URLBASE=$(echo "${TP_URLBASE}" | sed 's/\///g')
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2022-03-26 20:45:05 +01:00
|
|
|
DEFAULT='/defaults/default'
|
2022-03-29 21:33:56 +02:00
|
|
|
if [[ ${TP_URLBASE} ]]; then
|
2022-03-30 22:55:58 +02:00
|
|
|
if ! grep -q "location /${TP_URLBASE} {" "${DEFAULT}"; then
|
|
|
|
sed -i "s/location \//location \/${TP_URLBASE}/g" ${DEFAULT}
|
|
|
|
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}
|
|
|
|
sed -i "s/\$scheme/${TP_SCHEME}/g" ${DEFAULT}
|
|
|
|
fi
|
2022-03-29 21:33:56 +02:00
|
|
|
elif [[ -z ${TP_URLBASE} ]]; then
|
|
|
|
sed -i "s/TP_DOMAIN\/TP_URLBASE/${TP_DOMAIN}/g" ${DEFAULT}
|
2022-03-30 22:55:58 +02:00
|
|
|
sed -i "s/\$scheme/${TP_SCHEME}/g" ${DEFAULT}
|
2022-03-29 21:33:56 +02:00
|
|
|
fi
|
2022-03-23 18:55:57 +01:00
|
|
|
cp /defaults/default /config/nginx/site-confs
|
2022-03-22 10:06:13 +01:00
|
|
|
|
|
|
|
# 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
|
2022-03-22 21:23:15 +01:00
|
|
|
cp /app/themepark/CNAME /config/www
|
2022-03-22 10:06:13 +01:00
|
|
|
|
2022-03-28 18:12:52 +02:00
|
|
|
echo 'Creating CSS files'
|
|
|
|
python3 /config/www/themes.py
|
|
|
|
|
2022-03-22 10:06:13 +01:00
|
|
|
# permissions
|
|
|
|
chown -R abc:abc \
|
|
|
|
/config
|