From a8dacb76dec5cfa9514d7638987ca52b675c9251 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 17 Nov 2017 13:55:49 -0400 Subject: clean up qemu emulation binary when finalizing disk image This commit was sponsored by Denis Dzyubenko on Patreon. --- src/Propellor/Property/DiskImage.hs | 5 ++++- src/Propellor/Property/Qemu.hs | 8 +++++--- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/Propellor/Property/DiskImage.hs b/src/Propellor/Property/DiskImage.hs index e9c9d0d4..69a4b188 100644 --- a/src/Propellor/Property/DiskImage.hs +++ b/src/Propellor/Property/DiskImage.hs @@ -27,6 +27,7 @@ import qualified Propellor.Property.Chroot as Chroot import qualified Propellor.Property.Grub as Grub import qualified Propellor.Property.File as File import qualified Propellor.Property.Apt as Apt +import qualified Propellor.Property.Qemu as Qemu import Propellor.Property.Parted import Propellor.Property.Fstab (SwapPartition(..), genFstab) import Propellor.Property.Partition @@ -368,7 +369,9 @@ imageFinalized final img mnts mntopts devs (PartTable _ parts) = liftIO $ mountall top liftIO $ writefstab top liftIO $ allowservices top - ensureProperty w $ final img top devs + ensureProperty w $ + Qemu.removeHostEmulationBinary top + `before` final img top devs -- Ordered lexographically by mount point, so / comes before /usr -- comes before /usr/local diff --git a/src/Propellor/Property/Qemu.hs b/src/Propellor/Property/Qemu.hs index 4d9e8b1f..f204a0e1 100644 --- a/src/Propellor/Property/Qemu.hs +++ b/src/Propellor/Property/Qemu.hs @@ -19,9 +19,11 @@ foreignBinariesEmulated = (setup cleanup) -- -- Note that removing the binary will prevent using the chroot on the host -- system. -removeHostEmulationBinary :: Property DebianLike -removeHostEmulationBinary = tightenTargets $ - scriptProperty ["rm -f /usr/bin/qemu-*-static"] +-- +-- The FilePath is the path to the top of the chroot. +removeHostEmulationBinary :: FilePath -> Property Linux +removeHostEmulationBinary top = tightenTargets $ + scriptProperty ["rm -f " ++ top ++ "/usr/bin/qemu-*-static"] `assume` MadeChange -- | Check if the given System supports an Architecture. -- cgit v1.2.3