mirror of
https://github.com/mrvasil/ctf-ad-mirror-tool-rust.git
synced 2026-10-25 00:09:26 +00:00
29 lines
1023 B
Bash
29 lines
1023 B
Bash
#!/bin/sh
|
|
# Portable Linux launcher. Runtime data is never included in release archives.
|
|
set -eu
|
|
case "$(uname -s):$(uname -m)" in
|
|
Linux:x86_64|Linux:amd64) ;;
|
|
*) echo 'This package requires Linux x86-64.' >&2; exit 1 ;;
|
|
esac
|
|
cd -- "$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd)"
|
|
umask 077
|
|
mkdir -p data
|
|
if [ ! -e mirror.toml ]; then
|
|
(set -C; cat > mirror.toml <<'CONFIG'
|
|
# Add teams/services in the panel or use mirror.example.toml as a reference.
|
|
# Existing data/state.json takes precedence over teams/services in this file.
|
|
[web]
|
|
listen = "0.0.0.0:6700"
|
|
password = "mirror-tool-change-me"
|
|
state_file = "data/state.json"
|
|
CONFIG
|
|
)
|
|
fi
|
|
# Compatibility with v0.1.0: explicit web.password takes priority over this.
|
|
if [ -z "${MIRROR_PASSWORD:-}" ] && [ -f data/panel-password ]; then
|
|
MIRROR_PASSWORD=$(cat data/panel-password)
|
|
export MIRROR_PASSWORD
|
|
fi
|
|
echo 'Config/password: mirror.toml [web]. Default listener: 0.0.0.0:6700; open http://SERVER-IP:6700.'
|
|
exec ./mirror-tool --config mirror.toml "$@"
|