Unix OpenBSD How-to Easy Search and Find Packages with Dependencies Step-by-Step Guide

December 22nd, 2012 by Regaz



The Guide Shows You How-to Looking For from Command Line and Finding Packages with Dependencies on a Unix OpenBSD 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.

LilasToy OpenBSD
  1. Open a Command Line Session
  2. Install the pkg_find Script
    sudo su

    If Got “User is Not in Sudoers file” then Look: Solution

    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
    #
    export 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
    if [ $# -eq 0 ]
    then
    echo ""
    echo "EmilMod::Calomel.org.:.pkg_find"
    echo "————————————-"
    echo "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:"
    echo "http://www.openbsd.org/ftp.html#http”
    echo ""
    echo "If it is possible, choose the nearest to your location."
    echo ""
    echo ""
    echo "Syntax Usage: pkg_info [-u|string|–help]"
    echo ""
    echo "1) -u       = Update the local package listing."
    echo "2) 'string' = The package name or partial string of the package name you are looking for."
    echo "3) -help   = Show this help!"
    echo ""
    echo "Anything else will be taken as a 'string' for the pkg_find query."
    echo ""
    exit
    fi
    
    if [ $1 = "–help" ]
    then
    echo ""
    echo "EmilMod::Calomel.org.:.pkg_find"
    echo "————————————-"
    echo "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:"
    echo "http://www.openbsd.org/ftp.html#http”
    echo ""
    echo "If it is possible, choose the nearest to your location."
    echo ""
    echo ""
    echo "Syntax Usage: pkg_info [-u|string]"
    echo ""
    echo "1) -u       = Update the local package listing."
    echo "2) 'string' = The package name or partial string of the package name you are looking for."
    echo "3) -help   = Show this help!"
    echo ""
    echo "Anything else will be taken as a 'string' for the pkg_find query."
    echo ""
    exit
    fi
    
    if [ $1 = "-u" ]
    then
    echo ""
    echo -e "33[32m Download the package listing to $PACKAGES33[0m"
    echo ""
    wget -O $PACKAGES $PKG_PATH
    echo ""
    exit
    fi
    
    if [ $1 = "$@" ]
    then
    if [ -e $PACKAGES ]
    then
    echo ""
    echo -e "33[32m Packages matching your query: $@33[0m"
    echo ""
    cat $PACKAGES | grep -i $@ | cut -d\" -f6
    echo ""
    PKT_COUNT=$(cat $PACKAGES | grep -i $@ | cut -d\" -f6 | wc -l | sed 's/[ \t]*//')
    echo -e "33[32m $PKT_COUNT packets matched.33[0m"
    else
    echo ""
    echo -e "33[32m $PACKAGES file does not exist. Run 'pkg_find -u' to update33[0m"
    echo ""
    fi
    exit
    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 /bash.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

(Visited 2 times, 1 visits today)

Tags: , , , , , , , , ,


Comments are disabled