comparison sources/more/record-commands.sh @ 903:5ffc758bf60a

Genericize search path traversal logic with pattern and command to apply to each file found.
author Rob Landley <rob@landley.net>
date Thu, 26 Nov 2009 02:37:36 -0600
parents 726cac165450
children
comparison
equal deleted inserted replaced
902:ab47c4944591 903:5ffc758bf60a
8 # (Note: this misses things called via absolute paths, such as the #!/bin/bash 8 # (Note: this misses things called via absolute paths, such as the #!/bin/bash
9 # at the start of shell scripts.) 9 # at the start of shell scripts.)
10 10
11 echo "=== Setting up command recording wrapper" 11 echo "=== Setting up command recording wrapper"
12 12
13 echo OLDPATH=$OLDPATH
14 echo PATH=$PATH
15
16 [ -f "$WRAPDIR/wrappy" ] && PATH="$OLDPATH" 13 [ -f "$WRAPDIR/wrappy" ] && PATH="$OLDPATH"
17 [ -f "$HOSTTOOLS/busybox" ] && PATH="$HOSTTOOLS" 14 [ -f "$HOSTTOOLS/busybox" ] && PATH="$HOSTTOOLS"
18 blank_tempdir "$WRAPDIR" 15 blank_tempdir "$WRAPDIR"
19 blank_tempdir "$BUILD/logs" 16 blank_tempdir "$BUILD/logs"
20 17
21 # Populate a directory of symlinks with every command in the $PATH. 18 # Populate a directory of symlinks with every command in the $PATH.
22 19
23 wrap_path "$PATH" "$WRAPDIR" wrappy | dotprogress 20 path_search "$PATH" "*" 'ln -s wrappy "$WRAPDIR/$FILE"' | dotprogress
24 21
25 # Build the wrapper 22 # Build the wrapper
26 $CC -Os "$SOURCES/toys/wrappy.c" -o "$WRAPDIR/wrappy" || dienow 23 $CC -Os "$SOURCES/toys/wrappy.c" -o "$WRAPDIR/wrappy" || dienow