24 lines
1 KiB
Bash
24 lines
1 KiB
Bash
# Shared helpers for the site-sync test runners (sourced by run.sh, runPg.sh and
|
|
# runLivePull.sh; not executable on its own).
|
|
#
|
|
# Runner state must live OUTSIDE the plugin tree: installing site-sync by location
|
|
# copies the whole plugin directory into Saltcorn's plugins_folder (and every server
|
|
# boot re-copies it, merging), so state kept under the plugin dir leaks test
|
|
# databases, sessions and secrets into the installed plugin.
|
|
|
|
|
|
# make_state_dir <prefix>: print a fresh private directory for one runner invocation.
|
|
make_state_dir() {
|
|
mktemp -d "${TMPDIR:-/tmp}/$1.$$.XXXXXX"
|
|
}
|
|
|
|
|
|
# isolate_saltcorn_dirs <state>: point Saltcorn's plugins folder (env-paths:
|
|
# $XDG_DATA_HOME/saltcorn-plugins/plugins_folder) and its install temp dir ($TMPDIR)
|
|
# into <state>, so the by-location install copies the plugin there -- never into the
|
|
# shared ~/.local/share/saltcorn-plugins that the real instances load from.
|
|
isolate_saltcorn_dirs() {
|
|
export XDG_DATA_HOME="$1/xdg-data"
|
|
export TMPDIR="$1/tmp"
|
|
mkdir -p "$XDG_DATA_HOME" "$TMPDIR"
|
|
}
|