-
-
Save remusjones/9193929da2cea5284b52bb38ca4d7fcd to your computer and use it in GitHub Desktop.
Plutonium patch script for the felddy/foundryvtt container.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| version: "3.8" | |
| services: | |
| foundry: | |
| image: felddy/foundryvtt:release | |
| hostname: my_foundry_host | |
| init: true | |
| restart: "unless-stopped" | |
| volumes: | |
| - type: bind | |
| source: /home/USERHOME/foundrydata | |
| target: /data | |
| environment: | |
| - CONTAINER_CACHE=/data/container_cache | |
| - CONTAINER_PATCH_URLS=https://gist.githubusercontent.com/remusjones/9193929da2cea5284b52bb38ca4d7fcd/raw/82c9fad61a957971ceebc24b5f1616c720674112/plutoniumpatch.sh | |
| - CONTAINER_VERBOSE=true | |
| - CONTAINER_PRESERVE_CONFIG=true | |
| - FOUNDRY_COMPRESS_WEBSOCKET=true | |
| - FOUNDRY_PASSWORD= | |
| - FOUNDRY_USERNAME= | |
| - FOUNDRY_ADMIN_KEY= | |
| ports: | |
| - target: "30000" | |
| published: "30000" | |
| protocol: tcp | |
| mode: host |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # This patch script is for use with the felddy/foundryvtt Docker container. | |
| # See: https://github.com/felddy/foundryvtt-docker#readme | |
| # Installs the Plutonium module if it is not yet installed, and then patches the | |
| # Foundry server to call the Plutonium backend. | |
| MAIN_JS="${FOUNDRY_HOME}/resources/app/main.mjs" | |
| MODULE_BACKEND_JS="/data/Data/modules/plutonium/server/v12/plutonium-backend.mjs" | |
| MODULE_LOGIN_JS="/data/Data/modules/plutonium/server/v12/plutonium-backend-addon-custom-login.mjs" | |
| MODULE_DIR="/data/Data/modules" | |
| MODULE_DOC_URL="https://wiki.5e.tools/index.php/FoundryTool_Install" | |
| MODULE_URL="https://raw.githubusercontent.com/TheGiddyLimit/plutonium-next/master/plutonium-foundry12.zip" | |
| SUPPORTED_VERSIONS="0.8.6 0.8.7 0.8.8" | |
| WORKDIR=$(mktemp -d) | |
| ZIP_FILE="${WORKDIR}/plutonium.zip" | |
| log "Installing Plutonium module and backend." | |
| log "See: ${MODULE_DOC_URL}" | |
| if [ -z "${SUPPORTED_VERSIONS##*$FOUNDRY_VERSION*}" ] ; then | |
| log "This patch has been tested with Foundry Virtual Tabletop ${FOUNDRY_VERSION}" | |
| else | |
| log_warn "This patch has not been tested with Foundry Virtual Tabletop ${FOUNDRY_VERSION}" | |
| fi | |
| if [ ! -f $MODULE_BACKEND_JS ]; then | |
| log "Downloading Plutonium module." | |
| curl --output "${ZIP_FILE}" "${MODULE_URL}" 2>&1 | tr "\r" "\n" | |
| log "Ensuring module directory exists." | |
| mkdir -p "${MODULE_DIR}" | |
| log "Installing Plutonium module." | |
| unzip -o "${ZIP_FILE}" -d "${MODULE_DIR}" | |
| fi | |
| log "Installing Plutonium backend." | |
| cp "${MODULE_BACKEND_JS}" "${FOUNDRY_HOME}/resources/app/" | |
| log "Patching ${MAIN_JS} to use plutonium-backend." | |
| apk add patch | |
| patch --backup --quiet --batch ${MAIN_JS} << PATCH_FILE | |
| 26c26 | |
| < init.default({ | |
| --- | |
| > await init.default({ | |
| 31c31,32 | |
| < }) | |
| --- | |
| > }); | |
| > (await import("./plutonium-backend.mjs")).Plutonium.init(); | |
| PATCH_FILE | |
| patch_result=$? | |
| if [ $patch_result = 0 ]; then | |
| log "Plutonium backend patch was applied successfully." | |
| log "Plutonium art and media tools will be enabled." | |
| else | |
| log_error "Plutonium backend patch could not be applied." | |
| log_error "main.js did not contain the expected source lines." | |
| log_warn "Foundry Virtual Tabletop will still operate without the art and media tools enabled." | |
| log_warn "Update this patch file to a version that supports Foundry Virtual Tabletop ${FOUNDRY_VERSION}." | |
| mv "${MAIN_JS}.orig" "${MAIN_JS}" | |
| fi | |
| log "Cleaning up." | |
| cp "/data/Data/modules/plutonium/server/v12/plutonium-backend-addon-custom-login.mjs" "${FOUNDRY_HOME}/resources/app/" | |
| log "Copied Login CSS" | |
| rm -r ${WORKDIR} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment