summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/Debootstrap.hs
diff options
context:
space:
mode:
authorJoey Hess2014-11-22 21:10:35 -0400
committerJoey Hess2014-11-22 21:10:35 -0400
commit50b6e377906785a711371856e796ea14f295a76d (patch)
tree98a8e88a6ce8d84b2976074a2e1b864f51304777 /src/Propellor/Property/Debootstrap.hs
parent52799884a6aab347914726fb6c32002fd8c54603 (diff)
propellor spin
Diffstat (limited to 'src/Propellor/Property/Debootstrap.hs')
-rw-r--r--src/Propellor/Property/Debootstrap.hs22
1 files changed, 20 insertions, 2 deletions
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