1
0
mirror of https://github.com/gilbN/theme.park.git synced 2024-11-20 01:52:32 +01:00
theme.park/docker/root/etc/s6-overlay/s6-rc.d/init-themepark/run

58 lines
1.5 KiB
Plaintext
Raw Normal View History

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
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\
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
DEFAULT='/defaults/nginx/site-confs/default.conf'
2022-03-29 21:33:17 +02:00
if [[ ${TP_URLBASE} ]]; then
if ! grep -q "${TP_URLBASE}" "${DEFAULT}"; then
sed -i "s/themepark/${TP_URLBASE}/g" ${DEFAULT}
fi
2022-03-29 21:33:17 +02:00
fi
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
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 \
/config/www/{css,resources} \
/config/docker-mods
2022-03-22 10:05:36 +01: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
echo '[theme.park-init] Copying mods'
# 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
echo '[theme.park-init] done.'
2022-03-22 10:05:36 +01:00
# permissions
chown -R abc:abc \
/config