1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-13 16:15:30 +00:00
nixpkgs/modules/system/etc/make-etc.sh
Eelco Dolstra 11022e8d9f * Back out r17946 and 17948 because it doesn't work. I've seen it
fail to update /etc twice now.  It's also unnecessarily complex
  IMHO (see nix-dev).

svn path=/nixos/trunk/; revision=18045
2009-10-30 08:37:08 +00:00

23 lines
705 B
Bash

source $stdenv/setup
ensureDir $out/etc
sources_=($sources)
targets_=($targets)
modes_=($modes)
for ((i = 0; i < ${#targets_[@]}; i++)); do
ensureDir $out/etc/$(dirname ${targets_[$i]})
if ! test -e $out/etc/${targets_[$i]}; then
ln -s ${sources_[$i]} $out/etc/${targets_[$i]};
else
echo "Duplicate entry ${targets_[$i]} -> ${sources_[$i]}"
if test "$(readlink $out/etc/${targets_[$i]})" != "${sources_[$i]}"; then
echo "Mismatched duplicate entry $(readlink $out/etc/${targets_[$i]}) <-> ${sources_[$i]}"
exit 1
fi
fi;
if test "${modes_[$i]}" != symlink; then
echo "${modes_[$i]}" > $out/etc/${targets_[$i]}.mode
fi
done