how to query package (a.k.a product) owning file - HP UX

This is a discussion on how to query package (a.k.a product) owning file - HP UX ; How do I find out what installed package (I guess the HP-UX term for this is a product) a particular file belongs to? I can list all of the files contained within a package with the following: swlist -l file ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: how to query package (a.k.a product) owning file

  1. how to query package (a.k.a product) owning file

    How do I find out what installed package (I guess the HP-UX term for
    this is a
    product) a particular file belongs to?

    I can list all of the files contained within a package with the
    following:

    swlist -l file

    But is it possible to do the reverse query?

    Something equivalent to the following on other platforms:

    # redhat
    rpm -qf
    # debian
    dpkg -S
    # solaris
    # ok, i can't figure this out on solaris either.
    # i know it's the wrong forum, but does anyone know?

    Thanks for your help.

    - Rich


  2. Re: how to query package (a.k.a product) owning file

    On Fri, 10 Jun 2005 16:19:22 -0700, nospam420 wrote:

    > How do I find out what installed package (I guess the HP-UX term for
    > this is a
    > product) a particular file belongs to?
    >
    > I can list all of the files contained within a package with the
    > following:
    >
    > swlist -l file
    >
    > But is it possible to do the reverse query?


    if i'm not mistaken, you can use the 'what' command, it will give you a
    listing of which package/patch the commands is from.

    --
    Don't let your mind wander -- it's too little to be let out alone.


  3. Re: how to query package (a.k.a product) owning file

    dirk dierickx wrote:

    > On Fri, 10 Jun 2005 16:19:22 -0700, nospam420 wrote:
    >
    > > How do I find out what installed package (I guess the HP-UX term for
    > > this is a
    > > product) a particular file belongs to?
    > >
    > > I can list all of the files contained within a package with the
    > > following:
    > >
    > > swlist -l file
    > >
    > > But is it possible to do the reverse query?

    >
    > if i'm not mistaken, you can use the 'what' command, it will give you a
    > listing of which package/patch the commands is from.


    'what' does seem to be a tool to extract some information from some
    files, but it does not appear to be anything integrated into the HP-UX
    packaging system to do reverse queries. see the excerpt from the
    what(1) man page below.

    i would think that the most likely way to do this would be part of one
    of the sw* commands, namely:

    /usr/sbin/swacl
    /usr/sbin/swagentd
    /usr/sbin/swapinfo
    /usr/sbin/swapon
    /usr/sbin/swask
    /usr/sbin/swconfig
    /usr/sbin/swcopy
    /usr/sbin/swinstall
    /usr/sbin/swjob
    /usr/sbin/swlist
    /usr/sbin/swmodify
    /usr/sbin/swpackage
    /usr/sbin/swreg
    /usr/sbin/swremove
    /usr/sbin/swverify

    but i haven't yet been able to find this functionality with any of
    those commands.

    - rich

    -----

    NAME
    what - get SCCS identification information

    SYNOPSIS
    what [-s] file ...

    DESCRIPTION
    The what command searches the given files for all occurrences of
    the
    pattern that get(1) substitutes for %Z% (currently @(#) at this
    printing) and prints out what follows until the first ", >,
    new-line,
    \, or null character.


  4. Re: how to query package (a.k.a product) owning file

    : How do I find out what installed package (I guess the HP-UX term for
    : this is a product) a particular file belongs to?
    : swlist -l file
    : But is it possible to do the reverse query?

    Unfortunately the reverse query is done by brute force:
    swlist -l file | fgrep path/to/file

    There is a faster way but requires root:
    # find /var/adm/sw/products -name INFO -exec grep -il path/to/file +

  5. Re: how to query package (a.k.a product) owning file

    Marty Freitas wrote:

    > Unfortunately the reverse query is done by brute force:


    I was afraid that that was going to be the answer.

    > swlist -l file | fgrep path/to/file


    > # find /var/adm/sw/products -name INFO -exec grep -il path/to/file +


    Thanks for the help.

    Conceptually these look okay, but for real world use I can see one
    problem already. Here's one example that I've been using as a
    testcase. ncftp is installed at /usr/local/bin/ncftp via the package
    ncftp. The problem is that this is reported as follows:

    ncftp.ncftp-RUN: /usr/local/./bin/ncftp

    Which means that any brute force script parsing through this output
    needs to be intelligent enough to know that /usr/local/./bin/ncftp is
    the same file as /usr/local/bin/ncftp. I'd have to think a bit about
    whether there's some simple way to collapse that.

    - Rich


+ Reply to Thread