Don't pollute the global namespace with the contents of /etc/os-release

This commit is contained in:
Debarshi Ray 2019-03-11 17:01:29 +01:00
parent 6e69d34b7f
commit 1e0564d66c

17
toolbox
View file

@ -41,14 +41,11 @@ environment_variables="COLORTERM \
XDG_VTNR" XDG_VTNR"
fgc="" fgc=""
# shellcheck disable=SC1091
. /etc/os-release
release=$VERSION_ID
podman_pid="" podman_pid=""
prefix_sudo="" prefix_sudo=""
registry="registry.fedoraproject.org" registry="registry.fedoraproject.org"
registry_candidate="candidate-registry.fedoraproject.org" registry_candidate="candidate-registry.fedoraproject.org"
release=""
spinner_animation="[>----] [=>---] [==>--] [===>-] [====>] [----<] [---<=] [--<==] [-<===] [<====]" spinner_animation="[>----] [=>---] [==>--] [===>-] [====>] [----<] [---<=] [--<==] [-<===] [<====]"
spinner_template="toolbox-spinner-XXXXXXXXXX" spinner_template="toolbox-spinner-XXXXXXXXXX"
toolbox_container="" toolbox_container=""
@ -277,6 +274,14 @@ create_environment_options()
} }
get_host_version_id()
(
# shellcheck disable=SC1091
. /etc/os-release
echo "$VERSION_ID"
)
pull_base_toolbox_image() pull_base_toolbox_image()
( (
echo "$base_toolbox_command: looking for image localhost/$base_toolbox_image" >&3 echo "$base_toolbox_command: looking for image localhost/$base_toolbox_image" >&3
@ -793,6 +798,10 @@ forward_to_host()
update_container_and_image_names() update_container_and_image_names()
{ {
if [ "$release" = "" ] 2>&3; then
release=$(get_host_version_id)
fi
base_toolbox_image="fedora-toolbox:$release" base_toolbox_image="fedora-toolbox:$release"
fgc="f$release" fgc="f$release"
[ "$toolbox_container" = "" ] && toolbox_container="fedora-toolbox-$USER:$release" [ "$toolbox_container" = "" ] && toolbox_container="fedora-toolbox-$USER:$release"