[wplug] additional security when installing RPMs
Vanco, Donald
VANCOD at PIOS.com
Tue Jun 10 08:45:05 EDT 2003
RPMs get installed by root - if you have packages that you'd rather install
as non-root you can use "unrpm" - found here:
http://cvs.fedora.us/cgi-bin/cvsweb.cgi/packages/fedora-rpmdevtools/fedora-u
nrpm
Ville Skytta's "unrpm" script unpacks RPMs like a tarball in a
directory with same name as the rpm in question (without the dot rpm). It's
basically a wrapper for rpm2cpio, but it's kinda cool.
You can then pick over the contents or install parts as desired...
Here's the script:
(this was composed in Windoze LookOut, so cut-n-paste at your own risk)
#!/bin/sh
#
# fedora-unrpm
# Extract RPMs into PWD, "tar zxvf"-style
#
# Author: Ville Skyttä <ville.skytta at iki.fi>
# License: GPL
usage()
{
echo "Usage: `basename $0` RPMFILE..."
}
extract()
{
name=$(rpm -qp --qf "%{NAME}-%{VERSION}-%{RELEASE}" "$1")
if [ $? -ne 0 -o -z "$name" ]; then
echo "Warning: can't extract $name"
return 1
fi
# Is it an absolute filename?
absname="$1"
if ! echo "$1" | grep -q "^/" -; then
absname="$PWD/$1"
fi
(mkdir -p "$name" && \
cd "$name" && \
rpm2cpio "$absname" \
| cpio --quiet -ivdum 2>&1 \
| sed "s|^\(\./\)\?|$name/|" && \
cd ..)
}
if [ -z "$*" ]; then
usage
exit 1
fi
for file in $*; do
extract "$file"
done
More information about the wplug
mailing list