2006-11-03 13:33:24 +00:00
|
|
|
source $stdenv/setup
|
|
|
|
|
2012-01-18 20:16:00 +00:00
|
|
|
mkdir -p $out/bin
|
2006-11-03 13:33:24 +00:00
|
|
|
cat > $out/bin/nuke-refs <<EOF
|
|
|
|
#! $SHELL -e
|
2015-10-18 14:53:29 +00:00
|
|
|
|
|
|
|
excludes=""
|
|
|
|
while getopts e: o; do
|
|
|
|
case "\$o" in
|
|
|
|
e) storeId=\$(echo "\$OPTARG" | sed -n "s|^$NIX_STORE/\\([a-z0-9]\{32\}\\)-.*|\1|p")
|
|
|
|
if [ -z "\$storeId" ]; then
|
|
|
|
echo "-e argument must be a Nix store path"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
excludes="\$excludes(?!\$storeId)"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
shift \$((\$OPTIND-1))
|
|
|
|
|
|
|
|
for i in "\$@"; do
|
|
|
|
if test ! -L "\$i" -a -f "\$i"; then
|
|
|
|
cat "\$i" | $perl/bin/perl -pe "s|$NIX_STORE/\$excludes[a-z0-9]{32}-|$NIX_STORE/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-|g" > "\$i.tmp"
|
|
|
|
if test -x "\$i"; then chmod +x "\$i.tmp"; fi
|
|
|
|
mv "\$i.tmp" "\$i"
|
2009-01-16 17:13:14 +00:00
|
|
|
fi
|
2006-11-03 13:33:24 +00:00
|
|
|
done
|
|
|
|
EOF
|
|
|
|
chmod +x $out/bin/nuke-refs
|