2023-10-03 21:07:46 +02:00
|
|
|
#!/usr/bin/with-contenv bash
|
2022-03-20 21:26:59 +01:00
|
|
|
|
|
|
|
# Display variables for troubleshooting
|
2022-07-22 13:29:51 +02:00
|
|
|
echo -e "[theme.park-init] Variables set:\\n\
|
2022-03-22 10:05:36 +01:00
|
|
|
PUID=${PUID}\\n\
|
|
|
|
PGID=${PGID}\\n\
|
|
|
|
TZ=${TZ}\\n\
|
2022-04-08 22:19:45 +02:00
|
|
|
TP_DOMAIN=${TP_DOMAIN}\\n\
|
|
|
|
TP_URLBASE=${TP_URLBASE}\\n"
|
2022-03-29 21:33:17 +02:00
|
|
|
|
|
|
|
# Remove forward slash
|
|
|
|
case ${TP_URLBASE} in
|
|
|
|
*"/"*)
|
|
|
|
TP_URLBASE=$(echo "${TP_URLBASE}" | sed 's/\///g')
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2023-03-05 14:37:29 +01:00
|
|
|
DEFAULT='/defaults/nginx/site-confs/default.conf'
|
2022-03-29 21:33:17 +02:00
|
|
|
if [[ ${TP_URLBASE} ]]; then
|
2022-04-08 22:19:45 +02:00
|
|
|
if ! grep -q "${TP_URLBASE}" "${DEFAULT}"; then
|
|
|
|
sed -i "s/themepark/${TP_URLBASE}/g" ${DEFAULT}
|
2022-03-30 22:55:19 +02:00
|
|
|
fi
|
2022-03-29 21:33:17 +02:00
|
|
|
fi
|
2023-03-05 14:37:29 +01:00
|
|
|
|
|
|
|
echo '[theme.park-init] Copying nginx files'
|
|
|
|
cp -TR /defaults /config
|
2022-03-22 10:05:36 +01:00
|
|
|
|
2023-03-05 12:48:45 +01:00
|
|
|
# Remove old config
|
|
|
|
if [[ -f /config/nginx/site-confs/default ]]; then
|
2023-03-05 14:37:29 +01:00
|
|
|
echo '[theme.park-init] Removing old default file'
|
2023-03-05 12:48:45 +01:00
|
|
|
rm /config/nginx/site-confs/default
|
|
|
|
fi
|
|
|
|
|
2022-03-22 10:05:36 +01:00
|
|
|
# make our folders and links
|
|
|
|
mkdir -p \
|
2022-07-22 13:29:51 +02:00
|
|
|
/config/www/{css,resources} \
|
|
|
|
/config/docker-mods
|
2022-03-22 10:05:36 +01:00
|
|
|
|
2022-07-22 13:29:51 +02:00
|
|
|
echo '[theme.park-init] Copying theme files'
|
2022-03-22 10:05:36 +01:00
|
|
|
# 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:22:10 +01:00
|
|
|
cp /app/themepark/CNAME /config/www
|
2022-03-22 10:05:36 +01:00
|
|
|
|
2023-03-05 14:37:29 +01:00
|
|
|
echo '[theme.park-init] Copying mods'
|
2022-07-22 13:29:51 +02:00
|
|
|
# copy mods
|
|
|
|
for folder in /app/themepark/docker-mods/*; do \
|
|
|
|
cp /app/themepark/docker-mods/"${folder##*/}"/root/etc/cont-init.d/98-themepark /config/docker-mods/98-themepark-"${folder##*/}"; \
|
|
|
|
done
|
|
|
|
|
|
|
|
echo '[theme.park-init] Running themes.py and creating CSS files'
|
2022-03-28 18:12:13 +02:00
|
|
|
python3 /config/www/themes.py
|
2023-03-04 16:02:32 +01:00
|
|
|
echo '[theme.park-init] done.'
|
2022-03-22 10:05:36 +01:00
|
|
|
# permissions
|
|
|
|
chown -R abc:abc \
|
|
|
|
/config
|