summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog8
-rw-r--r--src/Propellor/CmdLine.hs2
-rw-r--r--src/Propellor/Property/DiskImage.hs16
-rw-r--r--src/Propellor/Property/Parted.hs2
-rw-r--r--src/Propellor/Property/Rsync.hs5
5 files changed, 30 insertions, 3 deletions
diff --git a/debian/changelog b/debian/changelog
index ef0f1ae4..ca9e40e9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+propellor (4.5.2) UNRELEASED; urgency=medium
+
+ * Added Rsync.installed property.
+ * Added DiskImage.vmdkBuilt property which is useful for booting
+ a disk image in VirtualBox.
+
+ -- Joey Hess <id@joeyh.name> Tue, 25 Jul 2017 17:08:52 -0400
+
propellor (4.5.1) unstable; urgency=medium
* Reboot.toKernelNewerThan: If running kernel is new enough, avoid
diff --git a/src/Propellor/CmdLine.hs b/src/Propellor/CmdLine.hs
index a36ec7f5..cba5991d 100644
--- a/src/Propellor/CmdLine.hs
+++ b/src/Propellor/CmdLine.hs
@@ -204,7 +204,7 @@ updateFirst h canrebuild cmdline next = ifM hasOrigin
, next
)
--- If changes can be fetched from origin, Builds propellor (when allowed)
+-- If changes can be fetched from origin, builds propellor (when allowed)
-- and re-execs the updated propellor binary to continue.
-- Otherwise, runs the IO action to continue.
updateFirst' :: Maybe Host -> CanRebuild -> CmdLine -> IO () -> IO ()
diff --git a/src/Propellor/Property/DiskImage.hs b/src/Propellor/Property/DiskImage.hs
index 950da58c..dd42265d 100644
--- a/src/Propellor/Property/DiskImage.hs
+++ b/src/Propellor/Property/DiskImage.hs
@@ -13,6 +13,7 @@ module Propellor.Property.DiskImage (
imageRebuilt,
imageBuiltFrom,
imageExists,
+ vmdkBuilt,
Grub.BIOS(..),
) where
@@ -409,3 +410,18 @@ toSysDir :: FilePath -> FilePath -> FilePath
toSysDir chrootdir d = case makeRelative chrootdir d of
"." -> "/"
sysdir -> "/" ++ sysdir
+
+-- | Builds a VirtualBox .vmdk file for the specified disk image file.
+vmdkBuilt :: FilePath -> RevertableProperty DebianLike UnixLike
+vmdkBuilt diskimage = (setup <!> cleanup)
+ `describe` (vmdkfile ++ " built")
+ where
+ vmdkfile = diskimage ++ ".vmdk"
+ setup = cmdProperty "VBoxManage"
+ [ "internalcommands", "createrawvmdk"
+ , "-filename", vmdkfile
+ , "-rawdisk", diskimage
+ ]
+ `changesFile` vmdkfile
+ `requires` Apt.installed ["virtualbox"]
+ cleanup = File.notPresent vmdkfile
diff --git a/src/Propellor/Property/Parted.hs b/src/Propellor/Property/Parted.hs
index 970f5b9a..43744142 100644
--- a/src/Propellor/Property/Parted.hs
+++ b/src/Propellor/Property/Parted.hs
@@ -111,7 +111,7 @@ partitionTableOverhead = MegaBytes 1
--
-- For example:
--
--- > calcPartTable (1024 * 1024 * 1024 * 100) MSDOS
+-- > calcPartTable (DiskSize (1024 * 1024 * 1024 * 100)) MSDOS
-- > [ partition EXT2 `mountedAt` "/boot"
-- > `setSize` MegaBytes 256
-- > `setFlag` BootFlag
diff --git a/src/Propellor/Property/Rsync.hs b/src/Propellor/Property/Rsync.hs
index 53baa74e..5665ab91 100644
--- a/src/Propellor/Property/Rsync.hs
+++ b/src/Propellor/Property/Rsync.hs
@@ -60,4 +60,7 @@ syncDirFiltered filters src dest = rsync $
rsync :: [String] -> Property (DebianLike + ArchLinux)
rsync ps = cmdProperty "rsync" ps
`assume` MadeChange
- `requires` Apt.installed ["rsync"] `pickOS` Pacman.installed ["rsync"]
+ `requires` installed
+
+installed :: Property (DebianLike + ArchLinux)
+installed = Apt.installed ["rsync"] `pickOS` Pacman.installed ["rsync"]