diff options
author | Andrew Cady <d@jerkface.net> | 2019-10-15 12:32:41 -0400 |
---|---|---|
committer | Andrew Cady <d@jerkface.net> | 2019-10-15 13:43:16 -0400 |
commit | 4f6e2688618364d21435b8bda0aed724eec6b65a (patch) | |
tree | 878c0ea50f29bfd56b22eeb5627eaef5eb129cfc /src | |
parent | 79ddffdec78b05f12243acbbe0e82dfdc238e76f (diff) |
implement 'binaries-optional:' and 'skel-files-optional:' sections
Diffstat (limited to 'src')
-rw-r--r-- | src/ConfigFile.hs | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/src/ConfigFile.hs b/src/ConfigFile.hs index 086ac7c..bc5e254 100644 --- a/src/ConfigFile.hs +++ b/src/ConfigFile.hs | |||
@@ -8,15 +8,15 @@ | |||
8 | {-# LANGUAGE ScopedTypeVariables #-} | 8 | {-# LANGUAGE ScopedTypeVariables #-} |
9 | 9 | ||
10 | module ConfigFile where | 10 | module ConfigFile where |
11 | import Rebase.Prelude hiding (bool, hash, (<.>)) | 11 | import Rebase.Prelude hiding (bool, hash, (<.>)) |
12 | 12 | ||
13 | import Data.Yaml.Combinators | 13 | import Data.Yaml.Combinators |
14 | import Development.Shake hiding (getEnv) | 14 | import Development.Shake hiding (getEnv) |
15 | import Development.Shake.Command () | 15 | import Development.Shake.Command () |
16 | import qualified Rebase.Data.Set as Set | 16 | import qualified Rebase.Data.Set as Set |
17 | import Rebase.Data.Text (pack, unpack) | 17 | import Rebase.Data.Text (pack, unpack) |
18 | import Rebase.Data.Text.Encoding | 18 | import Rebase.Data.Text.Encoding |
19 | import qualified Rebase.Data.Vector as Vector | 19 | import qualified Rebase.Data.Vector as Vector |
20 | {- | 20 | {- |
21 | 21 | ||
22 | Basic idea is to have a fs.yaml that specifies the build procedure. Analogous to | 22 | Basic idea is to have a fs.yaml that specifies the build procedure. Analogous to |
@@ -51,13 +51,15 @@ data BaseImageSpecification | |||
51 | deriving (Show, Read) | 51 | deriving (Show, Read) |
52 | 52 | ||
53 | data DiskImageConfig = DiskImageConfig { | 53 | data DiskImageConfig = DiskImageConfig { |
54 | initialImage :: BaseImageSpecification | 54 | initialImage :: BaseImageSpecification |
55 | , packages :: Set Package | 55 | , packages :: Set Package |
56 | , debconfConfig :: Maybe FilePath | 56 | , debconfConfig :: Maybe FilePath |
57 | , unpackOnly :: Bool | 57 | , unpackOnly :: Bool |
58 | , binaries :: Vector Text | 58 | , binaries :: Vector Text |
59 | , chrootCommands :: Vector Text | 59 | , optionalBinaries :: Vector Text |
60 | , skelFiles :: Vector Text | 60 | , chrootCommands :: Vector Text |
61 | , skelFiles :: Vector Text | ||
62 | , optionalSkelFiles :: Vector Text | ||
61 | } deriving (Show, Read) | 63 | } deriving (Show, Read) |
62 | 64 | ||
63 | parsePackageName :: Text -> Package | 65 | parsePackageName :: Text -> Package |
@@ -71,8 +73,10 @@ diskImageConfigParser = object $ | |||
71 | <*> (fmap unpack <$> optField "debconf" string) | 73 | <*> (fmap unpack <$> optField "debconf" string) |
72 | <*> defaultField "unpack-only" False bool | 74 | <*> defaultField "unpack-only" False bool |
73 | <*> defaultField "binaries" Vector.empty (array string) | 75 | <*> defaultField "binaries" Vector.empty (array string) |
76 | <*> defaultField "binaries-optional" Vector.empty (array string) | ||
74 | <*> defaultField "chroot-commands" Vector.empty (array string) | 77 | <*> defaultField "chroot-commands" Vector.empty (array string) |
75 | <*> defaultField "skel-files" Vector.empty (array string) | 78 | <*> defaultField "skel-files" Vector.empty (array string) |
79 | <*> defaultField "skel-files-optional" Vector.empty (array string) | ||
76 | 80 | ||
77 | readCfg :: FilePath -> Action DiskImageConfig | 81 | readCfg :: FilePath -> Action DiskImageConfig |
78 | readCfg yaml = either error id . parse diskImageConfigParser . encodeUtf8 . pack <$> readFile' yaml | 82 | readCfg yaml = either error id . parse diskImageConfigParser . encodeUtf8 . pack <$> readFile' yaml |