* make-etc.sh: fixed the duplicate entry check.

* Inlined make-etc.nix since it's a trivial function.

svn path=/nixos/trunk/; revision=16728
This commit is contained in:
Eelco Dolstra 2009-08-16 13:14:33 +00:00
parent 9493ecc2a4
commit 88c505c9e0
3 changed files with 16 additions and 22 deletions

View File

@ -36,9 +36,15 @@ let
chmod ${mode} "$target" chmod ${mode} "$target"
''; '';
makeEtc = import ./make-etc.nix { makeEtc = pkgs.stdenv.mkDerivation {
inherit (pkgs) stdenv; name = "etc";
configFiles = config.environment.etc;
builder = ./make-etc.sh;
/* !!! Use toXML. */
sources = map (x: x.source) config.environment.etc;
targets = map (x: x.target) config.environment.etc;
modes = map (x: if x ? mode then x.mode else "symlink") config.environment.etc;
}; };
in in

View File

@ -1,12 +0,0 @@
{stdenv, configFiles}:
stdenv.mkDerivation {
name = "etc";
builder = ./make-etc.sh;
/* !!! Use toXML. */
sources = map (x: x.source) configFiles;
targets = map (x: x.target) configFiles;
modes = map (x: if x ? mode then x.mode else "symlink") configFiles;
}

View File

@ -10,9 +10,9 @@ for ((i = 0; i < ${#targets_[@]}; i++)); do
if ! test -e $out/etc/${targets_[$i]}; then if ! test -e $out/etc/${targets_[$i]}; then
ln -s ${sources_[$i]} $out/etc/${targets_[$i]}; ln -s ${sources_[$i]} $out/etc/${targets_[$i]};
else else
echo Duplicate entry "${targets_[$i]} -> ${sources_[$i]}" echo "Duplicate entry ${targets_[$i]} -> ${sources_[$i]}"
if test "$(readlink "$targets_[$i]")" -ne "$sources_[$i]"; then if test "$(readlink $out/etc/${targets_[$i]})" != "${sources_[$i]}"; then
echo Mismatched duplicate entry "$(readlink "$targets_[$i]") "'<>'" $sources_[$i]" echo "Mismatched duplicate entry $(readlink $out/etc/${targets_[$i]}) <-> ${sources_[$i]}"
exit 1 exit 1
fi fi
fi; fi;