Fix handling of temporary directories in kickstart code. (#13744)
Instead of checking whether the `$tmpdir` variable is set and short-circuiting if it is, we should instead check if the directory it references exists. This ensures that code that needs to use temporary directories can do so even if earlier code calls `cleanup()`
Austin S. Hemmelgarn committed
Sep 29, 2022 at 10:14 UTC
cc2586de697702f86a3c34e60e23652dd4ddcb42
1 file changed
+1
-1
packaging/installer/kickstart.sh
+1
-1
@@ -515,7 +515,7 @@ create_tmp_directory() {
515
}
516
517
set_tmpdir() {
518
- if [ -z "${tmpdir}" ]; then
518
+ if [ -z "${tmpdir}" ] || [ ! -d "${tmpdir}" ]; then
519
tmpdir="$(create_tmp_directory)"
520
progress "Using ${tmpdir} as a temporary directory."
521
cd "${tmpdir}" || fatal "Failed to change current working directory to ${tmpdir}." F000A