os-release should be run in a subshell.

os-release should be run in a subshell to avoid the settings corrupting the main
script.
This commit is contained in:
Peter Ajamian 2021-05-12 11:11:36 +12:00
parent 7f08a2b696
commit fdadcac23d

View File

@ -48,13 +48,13 @@ logmessage(){
} }
# This just grabs a field from os-release and returns it. # This just grabs a field from os-release and returns it.
os-release () { os-release () (
. /etc/os-release . /etc/os-release
if ! [[ ${!1} ]]; then if ! [[ ${!1} ]]; then
return 1 return 1
fi fi
printf '%s\n' "${!1}" printf '%s\n' "${!1}"
} )
# All of the binaries used by this script are available in a EL8 minimal install # All of the binaries used by this script are available in a EL8 minimal install
# and are in /bin, so we should not encounter a system where the script doesn't # and are in /bin, so we should not encounter a system where the script doesn't