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:
parent
0f961c5ac8
commit
ad3346f915
|
|
@ -15,6 +15,9 @@ export XDG_CONFIG_HOME
|
||||||
readonly XDG_DATA_HOME="$HOME/.local/share"
|
readonly XDG_DATA_HOME="$HOME/.local/share"
|
||||||
export XDG_DATA_HOME
|
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"
|
readonly XDG_STATE_HOME="$HOME/.local/state"
|
||||||
export XDG_STATE_HOME
|
export XDG_STATE_HOME
|
||||||
|
|
||||||
|
|
@ -54,9 +57,7 @@ function cleanup_all() {
|
||||||
function _setup_environment() {
|
function _setup_environment() {
|
||||||
# shellcheck disable=SC2174
|
# shellcheck disable=SC2174
|
||||||
mkdir --mode 700 --parents "$HOME"
|
mkdir --mode 700 --parents "$HOME"
|
||||||
|
|
||||||
_setup_containers_storage
|
_setup_containers_storage
|
||||||
check_xdg_runtime_dir
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function _setup_containers_storage() {
|
function _setup_containers_storage() {
|
||||||
|
|
@ -576,11 +577,3 @@ function is_fedora_rawhide() (
|
||||||
|
|
||||||
return 0
|
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
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue