diff options
Diffstat (limited to 'modules/system/etc/make-etc.sh')
-rw-r--r-- | modules/system/etc/make-etc.sh | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/modules/system/etc/make-etc.sh b/modules/system/etc/make-etc.sh new file mode 100644 index 00000000000..4b7bb68be4b --- /dev/null +++ b/modules/system/etc/make-etc.sh @@ -0,0 +1,22 @@ +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 "$targets_[$i]")" -ne "$sources_[$i]"; then + echo Mismatched duplicate entry "$(readlink "$targets_[$i]") "'<>'" $sources_[$i]" + exit 1 + fi + fi; + if test "${modes_[$i]}" != symlink; then + echo "${modes_[$i]}" > $out/etc/${targets_[$i]}.mode + fi +done |