forked from DGNum/liminix
refactor
This commit is contained in:
parent
342c87b256
commit
f02efa3fe3
1 changed files with 24 additions and 22 deletions
|
@ -12,30 +12,32 @@ let
|
||||||
msg;
|
msg;
|
||||||
l =
|
l =
|
||||||
mapAttrsToList
|
mapAttrsToList
|
||||||
(filename: attrs:
|
(filename: {
|
||||||
|
type ? "f"
|
||||||
|
, mode ? null
|
||||||
|
, target ? null
|
||||||
|
, contents ? null
|
||||||
|
, file ? null
|
||||||
|
, major ? null
|
||||||
|
, minor ? null
|
||||||
|
, subtype ? null
|
||||||
|
}:
|
||||||
let
|
let
|
||||||
attrs' = {type = "f"; } // attrs;
|
mode' = if mode != null then mode else
|
||||||
mode = if attrs ? mode then attrs.mode else
|
(if type == "d" then "0755" else "0644");
|
||||||
(if attrs'.type == "d" then "0755" else "0644");
|
pathname = "${prefix}/${filename}";
|
||||||
line = "${prefix}/${filename} ${attrs'.type} ${mode} 0 0";
|
line = "${pathname} ${type} ${mode'} 0 0";
|
||||||
in
|
in
|
||||||
if attrs'.type == "f" then
|
if type == "f" then
|
||||||
"${line} echo -n \"${qprint attrs'.file}\" |qprint -d"
|
"${line} echo -n \"${qprint file}\" |qprint -d"
|
||||||
else if attrs'.type == "d" then
|
else if type == "d" then
|
||||||
(visit "${prefix}/${filename}" attrs.contents) +
|
(visit pathname contents) + "\n" + line
|
||||||
"\n" + line
|
else if type == "c" then "${line} ${major} ${minor}"
|
||||||
else if attrs'.type == "c" then
|
else if type == "b" then "${line} ${major} ${minor}"
|
||||||
with attrs'; "${line} ${major} ${minor}"
|
else if type == "s" then "${line} ${target}"
|
||||||
else if attrs'.type == "b" then
|
else if type == "l" then "${pathname} l ${target}"
|
||||||
with attrs'; "${line} ${major} ${minor}"
|
else if type == "i" then "${line} ${subtype}"
|
||||||
else if attrs'.type == "s" then
|
else line)
|
||||||
"${line} ${attrs'.target}"
|
|
||||||
else if attrs'.type == "l" then
|
|
||||||
"${prefix}/${filename} l ${attrs'.target}"
|
|
||||||
else if attrs'.type == "i" then
|
|
||||||
"${line} ${attrs.subtype}"
|
|
||||||
else
|
|
||||||
line)
|
|
||||||
attrset;
|
attrset;
|
||||||
in builtins.concatStringsSep "\n" l;
|
in builtins.concatStringsSep "\n" l;
|
||||||
in {
|
in {
|
||||||
|
|
Loading…
Reference in a new issue