diff options
| author | Joey Hess <joey@kitenet.net> | 2014-11-23 14:41:09 -0400 |
|---|---|---|
| committer | Joey Hess <joey@kitenet.net> | 2014-11-23 14:41:09 -0400 |
| commit | ac41f8b07b45b1855b1c10665757691a56b08353 (patch) | |
| tree | d446f81a4068ca594abd881c2b055ad2f8662a12 /src/Propellor/Property/Debootstrap.hs | |
| parent | 1b34f23414b574105ddfdf36fbeb86aa115a0e2e (diff) | |
| parent | 3c952a0de9d228eafe6e208007be7d2e018d68b8 (diff) | |
Merge branch 'joeyconfig'
Diffstat (limited to 'src/Propellor/Property/Debootstrap.hs')
| -rw-r--r-- | src/Propellor/Property/Debootstrap.hs | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/src/Propellor/Property/Debootstrap.hs b/src/Propellor/Property/Debootstrap.hs index 0611e735..ab5bddf4 100644 --- a/src/Propellor/Property/Debootstrap.hs +++ b/src/Propellor/Property/Debootstrap.hs @@ -8,6 +8,7 @@ module Propellor.Property.Debootstrap ( import Propellor import qualified Propellor.Property.Apt as Apt +import Propellor.Property.Chroot.Util import Utility.Path import Utility.SafeCommand import Utility.FileMode @@ -78,7 +79,8 @@ built target system@(System _ arch) config = , Param target ] cmd <- fromMaybe "debootstrap" <$> programPath - ifM (boolSystem cmd params) + de <- standardPathEnv + ifM (boolSystemEnv cmd params (Just de)) ( do fixForeignDev target return MadeChange @@ -141,8 +143,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 @@ -228,18 +248,23 @@ makeDevicesTarball = do tarcmd = "(cd / && tar cf - dev) | gzip > devices.tar.gz" fixForeignDev :: FilePath -> IO () -fixForeignDev target = whenM (doesFileExist (target ++ foreignDevFlag)) $ - void $ boolSystem "chroot" +fixForeignDev target = whenM (doesFileExist (target ++ foreignDevFlag)) $ do + de <- standardPathEnv + void $ boolSystemEnv "chroot" [ File target , Param "sh" , Param "-c" , Param $ intercalate " && " - [ "rm -rf /dev" + [ "apt-get update" + , "apt-get -y install makedev" + , "rm -rf /dev" , "mkdir /dev" , "cd /dev" + , "mount -t proc proc /proc" , "/sbin/MAKEDEV std ptmx fd consoleonly" ] ] + (Just de) foreignDevFlag :: FilePath foreignDevFlag = "/dev/.propellor-foreign-dev" |
