diff --git a/.changeset/perky-buckets-work.md b/.changeset/perky-buckets-work.md new file mode 100644 index 00000000..e253871a --- /dev/null +++ b/.changeset/perky-buckets-work.md @@ -0,0 +1,6 @@ +--- +"draupnir": major +--- + +All installations from source will need to change how they install, build, and +start Draupnir. diff --git a/draupnir-entrypoint.sh b/draupnir-entrypoint.sh index 4ae9c6b4..af63275f 100755 --- a/draupnir-entrypoint.sh +++ b/draupnir-entrypoint.sh @@ -3,17 +3,24 @@ # SPDX-FileCopyrightText: 2024 Gnuxie # SPDX-FileCopyrightText: 2022 The Matrix.org Foundation C.I.C. # -# SPDX-License-Identifier: Apache-2.0 AND AFL-3.0 +# SPDX-License-Identifier: Apache-2.0 -# This is used as the entrypoint in the draupnir Dockerfile. -# We want to transition away form people running the image without specifying `bot` or `appservice`. -# So if eventually cli arguments are provided for the bot version, we want this to be the opportunity to move to `bot`. -# Therefore using arguments without specifying `bot` (or appservice) is unsupported. -# We maintain the behaviour where if it looks like someone is providing an executable to `docker run`, then we will execute that instead. -# This aids configuration and debugging of the image if for example node needed to be started via another method. -case "$1" in - bot) shift; set -- node /apps/draupnir/dist/index.js "$@";; - appservice) shift; set -- node /apps/draupnir/dist/appservice/cli.js "$@";; +# This is used as the entrypoint in the draupnir Dockerfile and convenience for from-source installations. +# This allows us to set default options for node and to switch between the appservice and bot. + +# Help us normalise paths to make sure they are relative to where the script is. +draupnir_path="${0%/*}"; +test x"$draupnir_path" = x"$0" && draupnir_path='.'; +case "$draupnir_path" in + [!/.]*) draupnir_path="./$draupnir_path";; esac +case "$1" in + bot) shift; set -- node --enable-source-maps "${draupnir_path}/apps/draupnir/dist/index.js" "$@";; + appservice) shift; set -- node --enable-source-maps "${draupnir_path}/apps/draupnir/dist/appservice/cli.js" "$@";; +esac + +# If it looks like someone is providing an executable to `docker run`, then we will execute that instead. +# This aids configuration and debugging of the image if for example node needed to be started via another method, +# Or with different options for node. exec "$@";