2006-12-09 02:51:42 +00:00
|
|
|
source $stdenv/setup
|
|
|
|
|
2012-05-17 19:43:45 +01:00
|
|
|
mkdir -p $out/etc
|
2006-12-09 02:51:42 +00:00
|
|
|
|
2012-05-17 19:43:45 +01:00
|
|
|
set -f
|
2006-12-09 02:51:42 +00:00
|
|
|
sources_=($sources)
|
|
|
|
targets_=($targets)
|
2007-08-16 16:09:06 +01:00
|
|
|
modes_=($modes)
|
2017-07-21 15:41:19 +01:00
|
|
|
users_=($users)
|
|
|
|
groups_=($groups)
|
2012-05-17 19:43:45 +01:00
|
|
|
set +f
|
|
|
|
|
2006-12-09 02:51:42 +00:00
|
|
|
for ((i = 0; i < ${#targets_[@]}; i++)); do
|
2012-05-17 19:43:45 +01: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 13:59:01 +01:00
|
|
|
else
|
2012-05-17 19:43:45 +01:00
|
|
|
|
|
|
|
mkdir -p $out/etc/$(dirname $target)
|
|
|
|
if ! [ -e $out/etc/$target ]; then
|
|
|
|
ln -s $source $out/etc/$target
|
|
|
|
else
|
2012-10-05 02:44:45 +01:00
|
|
|
echo "duplicate entry $target -> $source"
|
2012-05-17 19:43:45 +01:00
|
|
|
if test "$(readlink $out/etc/$target)" != "$source"; then
|
2012-10-05 02:44:45 +01:00
|
|
|
echo "mismatched duplicate entry $(readlink $out/etc/$target) <-> $source"
|
2012-05-17 19:43:45 +01:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test "${modes_[$i]}" != symlink; then
|
2017-07-21 15:41:19 +01:00
|
|
|
echo "${modes_[$i]}" > $out/etc/$target.mode
|
|
|
|
echo "${users_[$i]}" > $out/etc/$target.uid
|
|
|
|
echo "${groups_[$i]}" > $out/etc/$target.gid
|
2009-08-16 14:14:33 +01:00
|
|
|
fi
|
2012-05-17 19:43:45 +01:00
|
|
|
|
2007-08-16 16:09:06 +01:00
|
|
|
fi
|
2006-12-09 02:51:42 +00:00
|
|
|
done
|
2011-09-06 13:32:07 +01:00
|
|
|
|