]> icculus.org git repositories - divverent/nexuiz.git/blob - misc/buildfiles/copystrip/strip
handle / in copystrip names
[divverent/nexuiz.git] / misc / buildfiles / copystrip / strip
1 #!/bin/sh
2 #THIS-IS-COPYSTRIP
3
4 # locate original 'strip' utility
5
6 stripfile=$1
7
8 case "$COPYSTRIP_STRIP" in
9         */*)
10                 exec "$COPYSTRIP_STRIP" "$stripfile"
11                 ;;
12 esac
13
14 p=$PATH
15 while [ -n "$p" ]; do
16         item=${p%%:*}/${COPYSTRIP_STRIP:-strip}
17         if [ -x "$item" ]; then
18                 case "`sed -n 2p "$item"`" in
19                         \#THIS-IS-COPYSTRIP)
20                                 echo >&2 "Found myself in $item"
21                                 ;;
22                         *)
23                                 echo >&2 "Using $item..."
24                                 cp "$stripfile" "$stripfile-withdebug"
25                                 exec "$item" "$stripfile"
26                                 ;;
27                 esac
28         fi
29         case "$p" in
30                 *:*)
31                         p=${p#*:}
32                         ;;
33                 *)
34                         echo >&2 "No strip found in PATH."
35                         exit 1
36                         ;;
37         esac
38 done