summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/FlashKernel.hs
diff options
context:
space:
mode:
authorJoey Hess2017-11-16 15:51:21 -0400
committerJoey Hess2017-11-16 15:51:21 -0400
commit540faf8215f8c38e1c6f8da4d82776986eea62a6 (patch)
treecb76aba1fea6137c183c715e62d6d98b1c86c62b /src/Propellor/Property/FlashKernel.hs
parent73e2ad46bd7472812008745125656661432eb092 (diff)
flash-kernel support
Can be used to create disk images for arm boards using flash-kernel. This commit was sponsored by Ewen McNeill.
Diffstat (limited to 'src/Propellor/Property/FlashKernel.hs')
-rw-r--r--src/Propellor/Property/FlashKernel.hs27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/Propellor/Property/FlashKernel.hs b/src/Propellor/Property/FlashKernel.hs
new file mode 100644
index 00000000..7aa8420b
--- /dev/null
+++ b/src/Propellor/Property/FlashKernel.hs
@@ -0,0 +1,27 @@
+-- | Make ARM systems bootable using Debian's flash-kernel package.
+
+module Propellor.Property.FlashKernel where
+
+import Propellor.Base
+import qualified Propellor.Property.File as File
+import qualified Propellor.Property.Apt as Apt
+import Propellor.Types.Bootloader
+import Propellor.Types.Info
+
+-- | A machine name, such as "Cubietech Cubietruck" or "Olimex A10-OLinuXino-LIME"
+--
+-- flash-kernel supports many different machines,
+-- see its file /usr/share/flash-kernel/db/all.db for a list.
+type Machine = String
+
+-- | Uses flash-kernel to make a machine bootable.
+--
+-- Before using this, an appropriate kernel needs to already be installed,
+-- and on many machines, u-boot needs to be installed too.
+installed :: Machine -> Property (HasInfo + DebianLike)
+installed machine = setInfoProperty go (toInfo [FlashKernelInstalled])
+ where
+ go = "/etc/flash-kernel/machine" `File.hasContent` [machine]
+ `onChange` (cmdProperty "flash-kernel" [] `assume` MadeChange)
+ `requires` File.dirExists "/etc/flash-kernel"
+ `requires` Apt.installed ["flash-kernel"]