# Prerequisites:
# SWIG (optional)
# Python (if you want the bindings)
# If you've previously installed this under the /usr/local prefix,
# run 'make uninstall' in the source directory as root to clean that up
# Get it
cd
test -f installed/libcap-ng-0.7.9.tar.gz &&
mv installed/libcap-ng-0.7.9.tar.gz .
test ! -f libcap-ng-0.7.9.tar.gz &&
wget http://people.redhat.com/sgrubb/libcap-ng/libcap-ng-0.7.9.tar.gz
# Extract the source
mkdir -p -m 0700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "libcap-ng-*" -exec rm -r {} \;
tar xzvf ~/libcap-ng-0.7.9.tar.gz
cd libcap-ng-0.7.9
test $UID = 0 && chown -R root:root .
# Configure the build for 64-bit
test $(uname -m) = 'x86_64' &&
./configure --prefix=/usr --libdir=/usr/lib64 --mandir=/usr/man
# Configure the build for anything else
test $(uname -m) != 'x86_64' &&
./configure --prefix=/usr --mandir=/usr/man
# Build it
make
# Become root to install it
su
# Remove the Slackware package, if there is one
test -x /sbin/removepkg && /sbin/removepkg libcap-ng
# Install it
make install
ldconfig
# Make sure your non-root user can remove the source later
chown -R $(logname) .
chmod -R u+w .
# Become your non-root user again
exit
# Save the source for later
cd
mkdir -p -m 0700 installed
rm -f installed/libcap-ng-*.tar.*
mv libcap-ng-0.7.9.tar.gz installed/
# If you ever want to uninstall libcap-ng, this should do it:
cd
su
test -d src/libcap-ng-* && ( cd src/libcap-ng-* ; make uninstall )
( cd /usr/bin ; rm -f captest filecap netcap pscap )
find /usr/lib -type f -name "libcap-ng.*" -exec rm {} \;
find /usr/lib64 -type f -name "libcap-ng.*" -exec rm {} \;
( cd /usr/man/man8 ; rm -f captest.8 filecap.8 netcap.8 pscap.8 )
rm -f /usr/include/cap-ng.h \
/usr/lib/pkgconfig/libcap-ng.pc /usr/lib64/pkgconfig/libcap-ng.pc \
/usr/man/man3/capng_*.3 /usr/share/aclocal/cap-ng.m4
# This hopefully outputs something like /usr/lib*/python*/site-packages
# You may want to verify with find also
( cd $(python -c "import site; print(site.getsitepackages()[0])"
rm -f _capng.* capng.* )
ldconfig
exit
find ~/src -maxdepth 1 -type d -name "libcap-ng-*" -exec rm -r {} \;
rm -f ~/installed/libcap-ng-*.tar.*