Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 37 lines 852 B view raw
1#! @shell@ -e 2 3fixupHooks=() 4 5if [ -e @out@/nix-support/setup-hooks.sh ]; then 6 source @out@/nix-support/setup-hooks.sh 7fi 8 9# References to remove 10targets=() 11while getopts t: o; do 12 case "$o" in 13 t) storeId=$(echo "$OPTARG" | sed -n "s|^@storeDir@/\\([a-z0-9]\{32\}\\)-.*|\1|p") 14 if [ -z "$storeId" ]; then 15 echo "-t argument must be a Nix store path" 16 exit 1 17 fi 18 targets+=("$storeId") 19 esac 20done 21shift $(($OPTIND-1)) 22 23# Files to remove the references from 24regions=() 25for i in "$@"; do 26 test ! -L "$i" -a -f "$i" && regions+=("$i") 27done 28 29for target in "${targets[@]}" ; do 30 sed -i -e "s|$target|eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee|g" "${regions[@]}" 31done 32 33for region in "${regions[@]}"; do 34 for hook in "${fixupHooks[@]}"; do 35 eval "$hook" "$region" 36 done 37done