diff options
| author | Joey Hess <joeyh@joeyh.name> | 2017-07-25 17:48:47 -0400 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2017-07-25 17:48:47 -0400 |
| commit | d35c1c7ad1539da24e6ab071d8d669912f330f0c (patch) | |
| tree | 489bdecd13326907d4cc827b4371d17f4c057e8e /src | |
| parent | 0f1f0b7a75398bbf1155d429612bd20415731bd1 (diff) | |
new properties
* Added Rsync.installed property.
* Added DiskImage.vmdkBuilt property which is useful for booting
a disk image in VirtualBox.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Propellor/CmdLine.hs | 2 | ||||
| -rw-r--r-- | src/Propellor/Property/DiskImage.hs | 16 | ||||
| -rw-r--r-- | src/Propellor/Property/Parted.hs | 2 | ||||
| -rw-r--r-- | src/Propellor/Property/Rsync.hs | 5 |
4 files changed, 22 insertions, 3 deletions
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"] |
