summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess2015-09-02 11:06:20 -0700
committerJoey Hess2015-09-02 11:06:20 -0700
commitbce9d314a94a1378ee35a4575aa7ecadf5967e62 (patch)
tree1fd4ba1089ba2a42589af7bc5b690a2e62b819c1
parente972d8bd6e283803ce4f5ef03cb35aa72de45d7f (diff)
Fix bug that caused provisioning new chroots to fail.
-rw-r--r--debian/changelog1
-rw-r--r--src/Propellor/Property/DiskImage.hs9
-rw-r--r--src/Propellor/Shim.hs15
3 files changed, 18 insertions, 7 deletions
diff --git a/debian/changelog b/debian/changelog
index 2431969e..61ed235b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,6 +6,7 @@ propellor (2.7.3) UNRELEASED; urgency=medium
(Not yet complete.)
* Update for Debian systemd-container package split.
* Dropped support for ghc 7.4.
+ * Fix bug that caused provisioning new chroots to fail.
-- Joey Hess <id@joeyh.name> Tue, 25 Aug 2015 13:45:39 -0700
diff --git a/src/Propellor/Property/DiskImage.hs b/src/Propellor/Property/DiskImage.hs
index 45f5ca40..6f2af863 100644
--- a/src/Propellor/Property/DiskImage.hs
+++ b/src/Propellor/Property/DiskImage.hs
@@ -35,6 +35,11 @@ import System.Posix.Files
-- Then, the disk image is set up, and the chroot is copied into the
-- appropriate partition(s) of it.
--
+-- Example use:
+--
+-- > import qualified Propellor.Property.DiskImage as DiskImage
+-- > import Propellor.Property.Parted
+--
-- > let chroot d = Chroot.debootstrapped (System (Debian Unstable) "amd64") mempty d
-- > & Apt.installed ["openssh-server"]
-- > & ...
@@ -59,6 +64,7 @@ built' rebuild img mkchroot mkparttable final =
-- TODO snd final
-- TODO copy in
-- TODO fst final
+ -- TODO chroot topevel directory perm fixup
`requires` Chroot.provisioned (mkchroot chrootdir)
`requires` (handlerebuild <!> doNothing)
`describe` desc
@@ -121,7 +127,8 @@ dirSizes top = go M.empty top [top]
-- | Where a partition is mounted. Use Nothing for eg, LinuxSwap.
type MountPoint = Maybe FilePath
--- | Specifies a mount point and a constructor for a Partition.
+-- | Specifies a mount point and a constructor for a Partition
+-- that will later be privided with a size.
type PartSpec = (MountPoint, PartSize -> Partition)
-- | Specifies a mounted partition using a given filesystem.
diff --git a/src/Propellor/Shim.hs b/src/Propellor/Shim.hs
index 7cdecefd..a3c8e701 100644
--- a/src/Propellor/Shim.hs
+++ b/src/Propellor/Shim.hs
@@ -55,12 +55,15 @@ shebang :: String
shebang = "#!/bin/sh"
checkAlreadyShimmed :: FilePath -> IO FilePath -> IO FilePath
-checkAlreadyShimmed f nope = withFile f ReadMode $ \h -> do
- fileEncoding h
- s <- hGetLine h
- if s == shebang
- then return f
- else nope
+checkAlreadyShimmed f nope = ifM (doesFileExist f)
+ ( withFile f ReadMode $ \h -> do
+ fileEncoding h
+ s <- hGetLine h
+ if s == shebang
+ then return f
+ else nope
+ , nope
+ )
-- Called when the shimmed propellor is running, so that commands it runs
-- don't see it.