Mercurial > hg > aboriginal
comparison sources/functions.sh @ 899:726cac165450
Remove old RECORD_COMMANDS debris from host-tools.sh and simplify result (lots of white-noise from de-intenting the "else" case of an if/else), factor out wrap_path from sources/more/record-commands.sh, fix the "build host tools first, then wrap it afterwards" case.
author | Rob Landley <rob@landley.net> |
---|---|
date | Mon, 23 Nov 2009 21:58:49 -0600 |
parents | db0f536aee7c |
children | 5ffc758bf60a |
comparison
equal
deleted
inserted
replaced
898:db0f536aee7c | 899:726cac165450 |
---|---|
682 do | 682 do |
683 echo -n ":$HOSTTOOLS/fallback-$X" | 683 echo -n ":$HOSTTOOLS/fallback-$X" |
684 X=$[$X+1] | 684 X=$[$X+1] |
685 done | 685 done |
686 } | 686 } |
687 | |
688 | |
689 # Create a directory of symlinks to all binaries in a colon-separated path. | |
690 | |
691 # Arguments are path to search, directory to populate, and (optionally) | |
692 # wrapper binary to symlink to instead of original binaries. | |
693 | |
694 wrap_path() | |
695 { | |
696 | |
697 # For each each $PATH element, loop through each file in that directory, | |
698 # and create a symlink to the wrapper with that name. In the case of | |
699 # duplicates, keep the first one. | |
700 | |
701 echo "$1" | sed 's/:/\n/g' | while read i | |
702 do | |
703 ls -1 "$i" | while read j | |
704 do | |
705 if [ ! -z "$3" ] | |
706 then | |
707 ln -s "$3" "$2/$j" 2>/dev/null | |
708 else | |
709 ln -s "$i/$j" "$2/$j" 2>/dev/null | |
710 fi | |
711 | |
712 # Output is verbose. Pipe it to dotprogress. | |
713 | |
714 echo $j | |
715 done | |
716 done | |
717 } | |
718 |