2006-12-09 03:51:42 +01:00
|
|
|
source $stdenv/setup
|
|
|
|
|
2012-05-17 20:43:45 +02:00
|
|
|
mkdir -p $out/etc
|
2006-12-09 03:51:42 +01:00
|
|
|
|
2012-05-17 20:43:45 +02:00
|
|
|
set -f
|
2006-12-09 03:51:42 +01:00
|
|
|
sources_=($sources)
|
|
|
|
targets_=($targets)
|
2007-08-16 17:09:06 +02:00
|
|
|
modes_=($modes)
|
2014-02-18 09:09:01 +01:00
|
|
|
uids_=($uids)
|
|
|
|
gids_=($gids)
|
2012-05-17 20:43:45 +02:00
|
|
|
set +f
|
|
|
|
|
2006-12-09 03:51:42 +01:00
|
|
|
for ((i = 0; i < ${#targets_[@]}; i++)); do
|
2012-05-17 20:43:45 +02:00
|
|
|
source="${sources_[$i]}"
|
|
|
|
target="${targets_[$i]}"
|
|
|
|
|
|
|
|
if [[ "$source" =~ '*' ]]; then
|
|
|
|
|
|
|
|
# If the source name contains '*', perform globbing.
|
|
|
|
mkdir -p $out/etc/$target
|
|
|
|
for fn in $source; do
|
|
|
|
ln -s "$fn" $out/etc/$target/
|
|
|
|
done
|
|
|
|
|
2009-05-18 14:59:01 +02:00
|
|
|
else
|
2012-05-17 20:43:45 +02:00
|
|
|
|
|
|
|
mkdir -p $out/etc/$(dirname $target)
|
|
|
|
if ! [ -e $out/etc/$target ]; then
|
|
|
|
ln -s $source $out/etc/$target
|
|
|
|
else
|
2012-10-05 03:44:45 +02:00
|
|
|
echo "duplicate entry $target -> $source"
|
2012-05-17 20:43:45 +02:00
|
|
|
if test "$(readlink $out/etc/$target)" != "$source"; then
|
2012-10-05 03:44:45 +02:00
|
|
|
echo "mismatched duplicate entry $(readlink $out/etc/$target) <-> $source"
|
2012-05-17 20:43:45 +02:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test "${modes_[$i]}" != symlink; then
|
|
|
|
echo "${modes_[$i]}" > $out/etc/$target.mode
|
2014-02-18 09:09:01 +01:00
|
|
|
echo "${uids_[$i]}" > $out/etc/$target.uid
|
|
|
|
echo "${gids_[$i]}" > $out/etc/$target.gid
|
2009-08-16 15:14:33 +02:00
|
|
|
fi
|
2012-05-17 20:43:45 +02:00
|
|
|
|
2007-08-16 17:09:06 +02:00
|
|
|
fi
|
2006-12-09 03:51:42 +01:00
|
|
|
done
|
2011-09-06 14:32:07 +02:00
|
|
|
|