Do we care about /sbin /bin linked to /usr/lib ?
Steve Grubb
sgrubb at redhat.com
Thu Sep 25 17:40:42 UTC 2008
On Thursday 25 September 2008 13:32:00 Jon Ciesla wrote:
> > This was not an everything install.
>
> I would think that we would care. I'd be very curious to see the
> results of this run on an everything install. And the code. :)
This and about 10-15 other programs are part of a collection
of programs I run as a post install check.
>From ~/.rpmmacros:
%__arch_install_post ~/checks/rpm-checks \
/usr/lib/rpm/check-rpaths \
/usr/lib/rpm/check-buildroot
this is the new program. Its designed to take a directory
path so it can be pointed to the rpm build install dir. It otherwise
defaults to "/" for everything install testing.
-Steve
#!/bin/sh
if [ $# -ge 2 ] ; then
echo "Usage: check-root-usr [directory]" 1>&2
exit 1
fi
DIR="/"
if [ $# -eq 1 ] ; then
if [ -d "$1" ] ; then
DIR="$1"
else
echo "Option passed in was not a directory" 1>&2
exit 1
fi
fi
rc=0
ROOT="/bin /sbin"
for d in $ROOT
do
# Skip dirs that are not in the package
if [ ! -e $DIR/$d ] ; then
continue
fi
files=`ls $DIR/$d`
for f in $files
do
# Skip apps we can't read
if [ ! -r $DIR$d/$f ] ; then
continue
fi
# Skip static linked apps
ldd $DIR$d/$f 2>/dev/null 1>&2
if [ $? -eq 1 ] ; then
continue
fi
ldd $DIR$d/$f | grep '\/usr\/' 2>/dev/null 1>&2
if [ $? -eq 0 ] ; then
echo "$d/$f uses something in /usr:"
ldd $DIR$d/$f | grep '\/usr\/' 2>/dev/null
rc=1
fi
done
done
exit $rc
More information about the devel
mailing list