sigil/lib/linux-script.dhall

44 lines
1.0 KiB
Plaintext
Raw Normal View History

2021-04-21 09:59:27 +02:00
let Sigil =
env:DHALL_SIGIL
? https://git.sr.ht/~ehmry/dhall-sigil/blob/trunk/package.dhall
2020-04-05 10:01:11 +02:00
2021-03-28 15:07:21 +02:00
let Prelude = Sigil.Prelude
2020-04-05 10:01:11 +02:00
2021-03-28 15:07:21 +02:00
let Args = { config : Sigil.Init.Type, rom : Sigil.BootModules.Type } : Type
2020-04-05 10:01:11 +02:00
2021-03-28 15:07:21 +02:00
let RomEntry = Prelude.Map.Entry Text Sigil.BootModules.ROM.Type
2020-04-05 10:01:11 +02:00
let addLine =
2021-04-21 09:59:27 +02:00
λ(e : RomEntry) →
λ(script : Text) →
merge
2020-04-05 10:01:11 +02:00
{ RomText =
2021-04-21 09:59:27 +02:00
λ(rom : Text) →
''
2020-04-05 10:01:11 +02:00
${script}
echo ${Text/show rom} > ${Text/show e.mapKey}
''
, RomPath =
2021-04-21 09:59:27 +02:00
λ(rom : Text) →
''
2020-04-05 10:01:11 +02:00
${script}
ln -s ${Text/show rom} ${Text/show e.mapKey}
''
}
e.mapValue
2021-04-21 09:59:27 +02:00
in λ(args : Args) →
λ(out : Text) →
{ config = Sigil.Init.render args.config
2020-04-13 20:26:01 +02:00
, script =
Prelude.List.fold
RomEntry
args.rom
Text
addLine
''
#!/bin/sh
ln -s ${out}/config config
''
}