diff --git a/README.md b/README.md index 9292657..ce38d6d 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ If you need to test functionality just run: ```bash docker pull lscr.io/linuxserver/d2-builder:latest && \ -docker run -d --rm -v /tmp/d2:/output -e PUID=1000 -e PGID=1000 lscr.io/linuxserver/d2-builder:latest mastodon:latest +docker run -d --rm -v /tmp/d2:/output -e PUID=1000 -e PGID=1000 -e SVG=true lscr.io/linuxserver/d2-builder:latest mastodon:latest ``` Generated svg files will be created in `/output`. diff --git a/readme-vars.yml b/readme-vars.yml index 9dc7f96..56c27ee 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -13,7 +13,7 @@ full_custom_readme: | ```bash docker pull lscr.io/linuxserver/d2-builder:latest && \ - docker run -d --rm -v /tmp/d2:/output -e PUID=1000 -e PGID=1000 lscr.io/linuxserver/d2-builder:latest mastodon:latest + docker run -d --rm -v /tmp/d2:/output -e PUID=1000 -e PGID=1000 -e SVG=true lscr.io/linuxserver/d2-builder:latest mastodon:latest ``` Generated svg files will be created in `/output`. diff --git a/root/etc/s6-overlay/s6-rc.d/init-d2-config/run b/root/etc/s6-overlay/s6-rc.d/init-d2-config/run index 1ee2a00..0434198 100755 --- a/root/etc/s6-overlay/s6-rc.d/init-d2-config/run +++ b/root/etc/s6-overlay/s6-rc.d/init-d2-config/run @@ -97,6 +97,7 @@ done shopt -s globstar +if [[ -n ${SVG} ]]; then cat < "/output/${OUTPUTNAME}" vars: { d2-config: { @@ -107,6 +108,7 @@ vars: { } EOF +fi echo "\"${IMAGENAME}:${TAGNAME}\": {" >> "/output/${OUTPUTNAME}" diff --git a/root/etc/s6-overlay/s6-rc.d/init-d2-output/run b/root/etc/s6-overlay/s6-rc.d/init-d2-output/run index 09798cb..def0e1b 100755 --- a/root/etc/s6-overlay/s6-rc.d/init-d2-output/run +++ b/root/etc/s6-overlay/s6-rc.d/init-d2-output/run @@ -15,7 +15,7 @@ else OUTPUTNAME="${IMAGENAME}-${TAGNAME}" fi -if [[ -z ${RAW} ]]; then +if [[ -n ${SVG} ]]; then s6-setuidgid abc d2 "/output/${OUTPUTNAME}.d2" "/output/${OUTPUTNAME}.svg" chmod 644 "/output/${OUTPUTNAME}.d2" "/output/${OUTPUTNAME}.svg" else