From 50b6e377906785a711371856e796ea14f295a76d Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 22 Nov 2014 21:10:35 -0400 Subject: propellor spin --- src/Propellor/Property/Debootstrap.hs | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'src/Propellor/Property/Debootstrap.hs') diff --git a/src/Propellor/Property/Debootstrap.hs b/src/Propellor/Property/Debootstrap.hs index 0611e735..fe87cc27 100644 --- a/src/Propellor/Property/Debootstrap.hs +++ b/src/Propellor/Property/Debootstrap.hs @@ -141,8 +141,26 @@ installed = RevertableProperty install remove aptremove = Apt.removed ["debootstrap"] sourceInstall :: Property -sourceInstall = property "debootstrap installed from source" - (liftIO sourceInstall') +sourceInstall = property "debootstrap installed from source" (liftIO sourceInstall') + `requires` perlInstalled + `requires` arInstalled + +perlInstalled :: Property +perlInstalled = check (not <$> inPath "perl") $ property "perl installed" $ do + v <- liftIO $ firstM id + [ yumInstall "perl" + ] + if isJust v then return MadeChange else return FailedChange + +arInstalled :: Property +arInstalled = check (not <$> inPath "ar") $ property "ar installed" $ do + v <- liftIO $ firstM id + [ yumInstall "binutils" + ] + if isJust v then return MadeChange else return FailedChange + +yumInstall :: String -> IO Bool +yumInstall p = boolSystem "yum" [Param "-y", Param "install", Param p] sourceInstall' :: IO Result sourceInstall' = withTmpDir "debootstrap" $ \tmpd -> do -- cgit v1.2.3