summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/FlashKernel.hs
blob: 7aa8420be8b5f78e21c8c7f924780719675d3d65 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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"]