diff --git a/docker-mods/duplicati/Dockerfile b/docker-mods/duplicati/Dockerfile new file mode 100644 index 00000000..5d11a1f6 --- /dev/null +++ b/docker-mods/duplicati/Dockerfile @@ -0,0 +1,7 @@ +FROM scratch + + +LABEL maintainer="GilbN" +LABEL app="Duplicati" +#copy local files. +COPY root/ / \ No newline at end of file diff --git a/docker-mods/duplicati/root/etc/cont-init.d/98-themepark b/docker-mods/duplicati/root/etc/cont-init.d/98-themepark new file mode 100644 index 00000000..293b111b --- /dev/null +++ b/docker-mods/duplicati/root/etc/cont-init.d/98-themepark @@ -0,0 +1,49 @@ +#!/usr/bin/with-contenv bash + +echo '----------------------------' +echo '| Duplicati theme.park Mod |' +echo '----------------------------' + +APP_FILEPATH='/app/duplicati/webroot' + +# Display variables for troubleshooting +echo -e "Variables set:\\n\ +'APP_FILEPATH'=${APP_FILEPATH}\\n\ +'TP_DOMAIN'=${TP_DOMAIN}\\n\ +'TP_THEME'=${TP_THEME}\\n" + +# Set default +if [[ -z ${TP_DOMAIN} ]]; then + echo 'No domain set, defaulting to theme-park.dev' + TP_DOMAIN='theme-park.dev' +fi + +case ${TP_DOMAIN} in + *"github.io"*) + echo "Switching to github.io URL style" + TP_DOMAIN="${TP_DOMAIN}\/theme.park" + ;; +esac + +if [[ -z ${TP_THEME} ]]; then + echo 'No theme set, defaulting to organizr-dark' + TP_THEME='organizr-dark' +fi + +sed_file(){ + sed -i "s/<\/head>/<\/head> /g" $1 + sed -i "s/<\/head>/<\/head> /g" $1 + printf 'Stylesheet set to %s on %s\n\n' "${TP_THEME}" "$1" +} + +# Adding stylesheets +echo '---------------------------------------' +echo '| Adding the stylesheet to html files |' +echo '---------------------------------------' + +if ! grep -q "${TP_DOMAIN}" "${APP_FILEPATH}/index.html"; then + find ${APP_FILEPATH} -type f -iname *.html | while read fname + do + sed_file $fname + done +fi