0
|
1 #!/bin/sh
|
|
2
|
|
3 set -x
|
|
4
|
|
5 CHRPATH=../chrpath
|
|
6
|
|
7 retval=0
|
|
8
|
|
9 rm prog
|
|
10 make prog
|
|
11
|
|
12 if $CHRPATH -h ; then
|
|
13 echo "success: chrpath -h worked."
|
|
14 else
|
|
15 echo "error: chrpath -h failed."
|
|
16 retval=1
|
|
17 fi
|
|
18
|
|
19 if $CHRPATH -v ; then
|
|
20 echo "success: chrpath -v worked."
|
|
21 else
|
|
22 echo "error: chrpath -v failed."
|
|
23 retval=1
|
|
24 fi
|
|
25
|
|
26 if $CHRPATH $0 ; then
|
|
27 echo "error: chrpath on /bin/sh script worked."
|
|
28 retval=1
|
|
29 else
|
|
30 echo "success: chrpath on /bin/sh script failed."
|
|
31 fi
|
|
32
|
|
33 if $CHRPATH non-existant-file ; then
|
|
34 echo "error: chrpath on non-existant file worked."
|
|
35 retval=1
|
|
36 else
|
|
37 echo "success: chrpath on non-existant file failed."
|
|
38 fi
|
|
39
|
|
40 if $CHRPATH -l prog | grep -q 'R.*PATH=.*/usr/local/lib' ; then
|
|
41 echo "success: chrpath listed current rpath."
|
|
42 else
|
|
43 echo "error: chrpath unable to list current rpath."
|
|
44 retval=1
|
|
45 fi
|
|
46
|
|
47 $CHRPATH -r '/usr/lib' prog > /dev/null
|
|
48
|
|
49 if $CHRPATH -l prog | grep -q 'R.*PATH=/usr/lib' ; then
|
|
50 echo "success: chrpath changed rpath."
|
|
51 else
|
|
52 echo "error: chrpath unable to change rpath."
|
|
53 retval=1
|
|
54 fi
|
|
55
|
|
56 # I wish inserting a larger path would work, but it doesn't yet
|
|
57 if $CHRPATH -r '/usr/lib:/usr/local/lib' prog > /dev/null ; then
|
|
58 echo "success: chrpath changed rpath to larger path."
|
|
59 else
|
|
60 echo "error: chrpath unable to change rpath to larger path."
|
|
61 fi
|
|
62
|
|
63 $CHRPATH -c prog > /dev/null
|
|
64
|
|
65 if $CHRPATH -l prog | grep -q 'RUNPATH=/usr/lib' ; then
|
|
66 echo "success: chrpath converted rpath to runpath."
|
|
67 else
|
|
68 # Not all archs support runpath, ie not a fatal error
|
|
69 echo "warning: chrpath unable to convert rpath to runpath."
|
|
70 fi
|
|
71
|
|
72 $CHRPATH -d prog > /dev/null
|
|
73
|
|
74 if $CHRPATH -l prog | grep -q 'no rpath or runpath tag found' ; then
|
|
75 echo "success: chrpath removed rpath and runpath successfully."
|
|
76 else
|
|
77 echo "error: chrpath unable to remove rpath or runpath."
|
|
78 retval=1
|
|
79 fi
|
|
80
|
|
81 exit $retval
|
|
82
|