summaryrefslogtreecommitdiff
path: root/bootstrap/files/strip-sh
blob: a737466080c9f3c4cce35df66604435fed3de0af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/sh
#
# On AIX, strip complains too much if the file is not
# writable, or if it's already stripped.
#
for f in "$@" ; do
	if ! /usr/bin/file "$f" | grep -q "not stripped" ; then
		# Skip the file if it's already stripped
		continue
	fi
	nowrite=0
	if [ ! -w "$f" ] ; then
		# Make sure it's writable.
		nowrite=1
		chmod +w "$f"
	fi
	/usr/bin/strip "$f"
	ret=$?
	if [ $nowrite -eq 1 ] ; then
		chmod -w "$f"
	fi
	if [ $ret -ne 0 ] ; then
		exit $ret
	fi
done
exit 0