From fdadcac23d629aca49698713b421751f1c35a310 Mon Sep 17 00:00:00 2001 From: Peter Ajamian Date: Wed, 12 May 2021 11:11:36 +1200 Subject: [PATCH] os-release should be run in a subshell. os-release should be run in a subshell to avoid the settings corrupting the main script. --- migrate2rocky.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/migrate2rocky.sh b/migrate2rocky.sh index d9e6ea3..b482d99 100644 --- a/migrate2rocky.sh +++ b/migrate2rocky.sh @@ -48,13 +48,13 @@ logmessage(){ } # This just grabs a field from os-release and returns it. -os-release () { +os-release () ( . /etc/os-release if ! [[ ${!1} ]]; then return 1 fi printf '%s\n' "${!1}" -} +) # 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