test/system: Simplify code by removing a function

It's simpler to check and set all the environment variables in one
place and in the same way, instead of having them scattered and using
different means.

https://github.com/containers/toolbox/pull/1676
This commit is contained in:
Debarshi Ray 2025-07-03 16:12:09 +02:00
parent 0f961c5ac8
commit ad3346f915
1 changed files with 3 additions and 10 deletions

View File

@ -15,6 +15,9 @@ export XDG_CONFIG_HOME
readonly XDG_DATA_HOME="$HOME/.local/share"
export XDG_DATA_HOME
readonly XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR:-/run/user/$UID}"
export XDG_RUNTIME_DIR
readonly XDG_STATE_HOME="$HOME/.local/state"
export XDG_STATE_HOME
@ -54,9 +57,7 @@ function cleanup_all() {
function _setup_environment() {
# shellcheck disable=SC2174
mkdir --mode 700 --parents "$HOME"
_setup_containers_storage
check_xdg_runtime_dir
}
function _setup_containers_storage() {
@ -576,11 +577,3 @@ function is_fedora_rawhide() (
return 0
)
# Set up the XDG_RUNTIME_DIR variable if not set
function check_xdg_runtime_dir() {
if [[ -z "${XDG_RUNTIME_DIR}" ]]; then
export XDG_RUNTIME_DIR="/run/user/${UID}"
fi
}