Unix OpenBSD 5 How to Search and Find Packages With Dependencies Step-by-Step Guide

December 22, 2012 | By Duchateaux.

The Guide shows you How to Looking For from Command Line and Finding Packages with Dependencies on a Unix OpenBSD 5 System.

For Details and deeper Insight about the Script go to: calomel.org.

Finally, the post’s Content is Expressly Reduced to Give Focus to the Essentials Instructions and Commands.

OpenBSD 5 How to Search and Find Packages - Featured
  1. Open a Command Line Session

  2. Install the pkg_find Script

    sudo su

    If Got “User is Not in Sudoers file” then see: How to Enable sudo

    mkdir /home/scripts

    vi /home/scripts/pkg_find.sh

    Type “i” to Start Editing on Vim
    Inserts:

    #!/bin/sh
    #
    ## Calomel.org  .:.  pkg_find v0.07
    ## Revisited by Emil
    #/nexport PKG_PATH=http://ftp.ch.openbsd.org/pub/OpenBSD/$(uname -r)/packages/$(uname -m)
    #
    ## location of the local package listing file
    PACKAGES=/usr/local/sbin/pkg_find_package_listing.html/nif [ $# -eq 0 ]
    then/necho ""/necho "EmilMod::Calomel.org.:.pkg_find"/necho "————————————-"/necho "For the 1st run, you need to edit this file, by compiling the PKG_PATH variable, with one of the OpenBSD FTP Mirrors listed at:"/necho "http://www.openbsd.org/ftp.html#http”/necho ""/necho "If it is potential, choose the nearest to your location."/necho ""/necho ""/necho "Syntax Usage: pkg_info [-u|string|–help]"/necho ""/necho "1) -u       = Update the local package listing."/necho "2) 'string' = The package name or partial string of the package name you are looking for."/necho "3) -help   = Show this help!"/necho ""/necho "Anything else will be taken as a 'string' for the pkg_find query."/necho ""/nexit
    fi
    /nif [ $1 = "–help" ]
    then/necho ""/necho "EmilMod::Calomel.org.:.pkg_find"/necho "————————————-"/necho "For the 1st run, you need to edit this file, by compiling the PKG_PATH variable, with one of the OpenBSD FTP Mirrors listed at:"/necho "http://www.openbsd.org/ftp.html#http”/necho ""/necho "If it is potential, choose the nearest to your location."/necho ""/necho ""/necho "Syntax Usage: pkg_info [-u|string]"/necho ""/necho "1) -u       = Update the local package listing."/necho "2) 'string' = The package name or partial string of the package name you are looking for."/necho "3) -help   = Show this help!"/necho ""/necho "Anything else will be taken as a 'string' for the pkg_find query."/necho ""/nexit
    fi
    /nif [ $1 = "-u" ]
    then/necho ""/necho -e "33[32m Download the package listing to $PACKAGES33[0m"/necho ""
    wget -O $PACKAGES $PKG_PATH/necho ""/nexit
    fi
    /nif [ $1 = "$@" ]
    then/nif [ -e $PACKAGES ]
    then/necho ""/necho -e "33[32m Packages matching your query: $@33[0m"/necho ""
    cat $PACKAGES | grep -i $@ | cut -d" -f6/necho ""
    PKT_COUNT=$(cat $PACKAGES | grep -i $@ | cut -d" -f6 | wc -l | sed 's/[ \t]*//')/necho -e "33[32m $PKT_COUNT packets matched.33[0m"/nelse/necho ""/necho -e "33[32m $PACKAGES file does not exist. Run 'pkg_find -u' to update33[0m"/necho ""
    fi/nexit
    fi
    

    Thanks to: dant.net.ru
    Esc and after :wq to Save & Exit from Vim :)
    Give Right Permissions:

    chmod +x /home/scripts/pkg_find.sh

    Make a Symlink for Easy Use:

    ln -s /home/scripts/pkg_find.sh /usr/local/bin/pkg_find

  3. Installing Needed Bash Shell

    pkg_add -v [URL]/bash[x.y.z].tgz

    OpenBSD How to Easy Find Repo URL for Installing New Packages:

    OpenBSD Find Packages Repository
  4. SetUp the Environment Variable PKG_PATH

    exit

    vi /home//.profile

    source /home//.profile

  5. Downloading/Updating the Packages List

    pkg_find -u

    The Packages List is Saved into File: /home/scripts/pkg_find_package_listing.html

  6. Looking For OpenBSD Packges

    pkg_find 

    pkg_find tidy


QuickChic Theme • Powered by WordPress