]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
dracut.sh: make tmp dirs after the trap function is installed
authorHarald Hoyer <harald@redhat.com>
Wed, 29 Jun 2016 15:32:31 +0000 (17:32 +0200)
committerHarald Hoyer <harald@redhat.com>
Wed, 29 Jun 2016 15:32:31 +0000 (17:32 +0200)
otherwise a good timed ctrl-c will leave the tmp dir around

dracut.sh

index a50eaff757c076777be992069665313d74bd4279..36607cfbc0767e10bbbb0f64a5273a8e62fb784b 100755 (executable)
--- a/dracut.sh
+++ b/dracut.sh
@@ -823,13 +823,7 @@ readonly DRACUT_TMPDIR="$(mktemp -p "$TMPDIR/" -d -t dracut.XXXXXX)"
     printf "%s\n" "dracut: mktemp -p '$TMPDIR/' -d -t dracut.XXXXXX failed." >&2
     exit 1
 }
-readonly initdir="${DRACUT_TMPDIR}/initramfs"
-mkdir "$initdir"
 
-if [[ $early_microcode = yes ]] || ( [[ $acpi_override = yes ]] && [[ -d $acpi_table_dir ]] ); then
-    readonly early_cpio_dir="${DRACUT_TMPDIR}/earlycpio"
-    mkdir "$early_cpio_dir"
-fi
 # clean up after ourselves no matter how we die.
 trap '
     ret=$?;
@@ -840,6 +834,14 @@ trap '
 # clean up after ourselves no matter how we die.
 trap 'exit 1;' SIGINT
 
+readonly initdir="${DRACUT_TMPDIR}/initramfs"
+mkdir "$initdir"
+
+if [[ $early_microcode = yes ]] || ( [[ $acpi_override = yes ]] && [[ -d $acpi_table_dir ]] ); then
+    readonly early_cpio_dir="${DRACUT_TMPDIR}/earlycpio"
+    mkdir "$early_cpio_dir"
+fi
+
 export DRACUT_RESOLVE_LAZY="1"
 
 if [[ $print_cmdline ]]; then