diff options
-rw-r--r-- | clone/virt-sysprep.in | 8 | ||||
-rw-r--r-- | fish/guestfish.pod | 11 |
2 files changed, 10 insertions, 9 deletions
diff --git a/clone/virt-sysprep.in b/clone/virt-sysprep.in index b6c8a404..792282c7 100644 --- a/clone/virt-sysprep.in +++ b/clone/virt-sysprep.in @@ -175,16 +175,16 @@ if [ -z "$GUESTFISH_PID" ]; then exit 1 fi +# Helper. +gf="guestfish --remote --" + cleanup () { - kill $GUESTFISH_PID >/dev/null 2>&1 ||: + $gf exit >/dev/null 2>&1 ||: rm -rf "$tmpdir" ||: } trap cleanup EXIT ERR -# Helper. -gf="guestfish --remote --" - # Launch back-end, inspect for operating systems, and get the guest # root disk. root=$($gf inspect-get-roots) diff --git a/fish/guestfish.pod b/fish/guestfish.pod index 022e03e2..81909696 100644 --- a/fish/guestfish.pod +++ b/fish/guestfish.pod @@ -996,14 +996,15 @@ and cleans up guestfish when the script exits: exit 1 fi - kill_guestfish () + cleanup_guestfish () { - kill $GUESTFISH_PID >/dev/null 2>&1 ||: + guestfish --remote -- exit >/dev/null 2>&1 ||: } - trap kill_guestfish EXIT + trap cleanup_guestfish EXIT ERR - guestfish --remote run - # etc. + guestfish --remote -- run + + # ... =head2 REMOTE CONTROL RUN COMMAND HANGING |