summaryrefslogtreecommitdiff
path: root/src/Propellor
diff options
context:
space:
mode:
Diffstat (limited to 'src/Propellor')
-rw-r--r--src/Propellor/Property/DiskImage.hs1
-rw-r--r--src/Propellor/Property/FlashKernel.hs27
-rw-r--r--src/Propellor/Types/Bootloader.hs4
3 files changed, 31 insertions, 1 deletions
diff --git a/src/Propellor/Property/DiskImage.hs b/src/Propellor/Property/DiskImage.hs
index 6c1a572c..7493dd21 100644
--- a/src/Propellor/Property/DiskImage.hs
+++ b/src/Propellor/Property/DiskImage.hs
@@ -192,6 +192,7 @@ imageBuilt' rebuild img mkchroot tabletype partspec =
-- installed.
final = case fromInfo (containerInfo chroot) of
[GrubInstalled] -> grubBooted
+ [FlashKernelInstalled] -> \_ _ -> doNothing
[] -> unbootable "no bootloader is installed"
_ -> unbootable "multiple bootloaders are installed; don't know which to use"
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"]
diff --git a/src/Propellor/Types/Bootloader.hs b/src/Propellor/Types/Bootloader.hs
index 4a75503a..9822d520 100644
--- a/src/Propellor/Types/Bootloader.hs
+++ b/src/Propellor/Types/Bootloader.hs
@@ -5,7 +5,9 @@ module Propellor.Types.Bootloader where
import Propellor.Types.Info
-- | Boot loader installed on a host.
-data BootloaderInstalled = GrubInstalled
+data BootloaderInstalled
+ = GrubInstalled
+ | FlashKernelInstalled
deriving (Typeable, Show)
instance IsInfo [BootloaderInstalled] where