module Propellor.Property.Qemu where
import Propellor.Base
import qualified Propellor.Property.Apt as Apt
foreignBinariesEmulated :: RevertableProperty Linux Linux
foreignBinariesEmulated = (setup <!> cleanup)
`describe` "foreign binary emulation"
where
setup = Apt.installed p `pickOS` unsupportedOS
cleanup = Apt.removed p `pickOS` unsupportedOS
p = ["qemu-user-static"]
removeHostEmulationBinary :: FilePath -> Property Linux
removeHostEmulationBinary top = tightenTargets $
scriptProperty ["rm -f " ++ top ++ "/usr/bin/qemu-*-static"]
`assume` MadeChange
supportsArch :: System -> Architecture -> Bool
supportsArch (System os a) b
| a == b = True
| otherwise = case os of
Debian _ _ -> debianlike
Buntish _ -> debianlike
_ -> False
where
debianlike =
let l =
[ (X86_64, X86_32)
, (ARMHF, ARMEL)
, (PPC, PPC64)
, (SPARC, SPARC64)
, (S390, S390X)
]
in elem (a, b) l || elem (b, a) l