aboutsummaryrefslogtreecommitdiffstats
path: root/FAQ
diff options
context:
space:
mode:
Diffstat (limited to 'FAQ')
-rw-r--r--FAQ78
1 files changed, 78 insertions, 0 deletions
diff --git a/FAQ b/FAQ
index c7e27c3..217e689 100644
--- a/FAQ
+++ b/FAQ
@@ -48,6 +48,7 @@ Frequenty Asked Questions:
45. Will slapt-get break my system?
46. What is a meta package and how can I take advantage of it?
47. How can I downgrade a package?
+48. How can I search the contents of a package for a file or library?
@@ -950,4 +951,81 @@ Frequenty Asked Questions:
Do you want to continue? [y/N]
+48. How can I search the contents of a package for a file or library?
+
+ Slapt-get does not pay attention to the contents of packages. Slackware
+ provides the MANIFEST.bz2 and the contents of /var/log/packages for such
+ functionality. Searching for which installed package owns a file is
+ accomplished the easiest by using grep with the contents of
+ /var/log/packages/.
+
+ The same can be done with the MANIFEST.bz2 file. You can use one of the
+ following solutions:
+
+ Put something like this in your shell's rc file (or /etc/profile) would do
+ just as well:
+
+ # begin
+ function search_manifest {
+ LASTPKG=
+
+ if [ -z "$1" ]; then return;fi
+
+ if [ -z "$MANIFEST" ]; then
+ echo "Please set MANIFEST env variable to point to a downloaded MANIFEST.bz2"
+ return
+ fi
+
+ if [ ! -f ${MANIFEST/MANIFEST.bz2/package_list} ]; then
+ bzgrep -n ' Package\: ' ${MANIFEST}|awk '{print $1 $3}'|sed -re "s/\|//g" >
+ ${MANIFEST/MANIFEST.bz2/package_list}
+ fi
+
+ FILE=$( echo $1 | sed -re "s/^\///");
+ LOOKUP=$(bzgrep -n $FILE $MANIFEST|cut -f1 -d':')
+
+ if [ -z "$LOOKUP" ]; then
+ echo "$1 not found in $MANIFEST"
+ return
+ fi
+
+ for pkgline in `cat ${MANIFEST/MANIFEST.bz2/package_list}|cut -f1 -d':'`
+ do
+
+ if [ $LOOKUP -gt $pkgline ]; then
+ false
+ else
+ LASTPKG=`grep -B 1 $pkgline ${MANIFEST/MANIFEST.bz2/package_list}|head -1 \
+ |cut -f2 -d':'|cut -f3 -d'/'`
+ echo $LASTPKG $1
+ return
+ fi
+
+ done
+ }
+ #end
+
+ Then you'd just call from your shell search_manifest /usr/lib/libpci.a:
+ pciutils-2.1.11-i486-5.tgz /usr/lib/libpci.a
+
+ Or you can use this solution provided by Nathan Morell <frizop at eatel.net>
+
+ #!/usr/bin/perl
+ use strict;
+ use warnings;
+ use PerlIO::gzip;
+
+ open FOO, "<:gzip", "/home/jidar/MANIFEST.gz" or die $!;
+
+ my $temp;
+ while (<FOO>){ # And it will be uncompressed...
+ if ($_ =~ m/\|\| Package: /g) {
+ $_ =~ s/\|\| Package: /PACKAGE: /g;
+ $temp = $_;
+ }
+ if ($_ =~ m/($ARGV[0])/g) {
+ print $temp . $_;
+ }
+ }
+