2021-05-28 09:39:13 +00:00
|
|
|
#! @shell@ -e
|
|
|
|
|
|
|
|
fixupHooks=()
|
|
|
|
|
|
|
|
if [ -e @out@/nix-support/setup-hooks.sh ]; then
|
|
|
|
source @out@/nix-support/setup-hooks.sh
|
|
|
|
fi
|
|
|
|
|
|
|
|
# References to remove
|
|
|
|
targets=()
|
|
|
|
while getopts t: o; do
|
|
|
|
case "$o" in
|
|
|
|
t) storeId=$(echo "$OPTARG" | sed -n "s|^@storeDir@/\\([a-z0-9]\{32\}\\)-.*|\1|p")
|
|
|
|
if [ -z "$storeId" ]; then
|
|
|
|
echo "-t argument must be a Nix store path"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
targets+=("$storeId")
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
shift $(($OPTIND-1))
|
|
|
|
|
|
|
|
# Files to remove the references from
|
|
|
|
regions=()
|
|
|
|
for i in "$@"; do
|
|
|
|
test ! -L "$i" -a -f "$i" && regions+=("$i")
|
|
|
|
done
|
|
|
|
|
|
|
|
for target in "${targets[@]}" ; do
|
2022-09-30 11:47:45 +00:00
|
|
|
sed -i -e "s|$target|eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee|g" "${regions[@]}"
|
2021-05-28 09:39:13 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
for region in "${regions[@]}"; do
|
|
|
|
for hook in "${fixupHooks[@]}"; do
|
2023-07-15 17:15:38 +00:00
|
|
|
eval "$hook" "$region"
|
2021-05-28 09:39:13 +00:00
|
|
|
done
|
|
|
|
done
|