FreeBSD Scripts

Here you can find some scripts that made life easier for me. Maybe they can help you too?

psearch

A utility for searching the FreeBSD ports. It lets you specify a regular expression for searching, can search the long description (pkg-descr file), or do an inverse match, similar to grep -v.

Here's an example that shows how it works:

$ psearch firefox
chinese/firefox-zh_CN    Firefox Simplified Chinese(zh-CN) Language Pack
chinese/firefox-zh_TW    Firefox Traditional Chinese(zh-TW) Language Pack
japanese/firefox-ja      Firefox Japanese(ja) Language Pack
korean/firefox-ko        Firefox Korean(ko) Language Pack
www/adblock-firefox      A content filtering plug-in for Firefox
www/bugmenot-firefox     Firefox extension to bypass compulsory web registration
www/firefox              Web browser based on the browser portion of Mozilla
www/firefox-remote       Wrapper scripts for firefox web browser
www/linux-firefox        Web browser based on the browser portion of Mozilla
www/mozex-firefox        Mozex allows Firefox's users to use external programs for mail, news, etc.
www/preferential-firefox GUI interface to view & edit all Firefox prefs

psearch has been added to the FreeBSD ports collection under ports-mgmt/psearch. I suggest you use that to install it. If you still want to download it manually, here you go:

Download psearch-2.0.1.tar.gz

The current version 2 of psearch is written in C++. If for some reason you want the previous version which is written in Python, use the following link.

Download psearch-1.2.tar.gz (legacy version)


findlibusers.py

This script was written after the release of FreeBSD-5.3-BETA7 as a tool to figure out which packages needed to be rebuilt as a result of the library bump. What it does is listing all packages that have files using the libraries specified in the badlibs array.

This script is written in Python, which you may have to install first on your system.

Download findlibusers.py


makesubindex

Note: This script has been superseded by psearch, and I recommend that you use psearch instead of this.

This Perl script takes /usr/ports/INDEX-5 and creates a series of leaner index files that are more suitable for browsing and grepping. Toss it into /usr/ports, and run it as root to generate the index files. Rerun it every time your INDEX-5 file changes to update the index files as well.

Here's an example showing how using those index files works:

$ grep regexp /usr/ports/index
dgd-net         net/dgd-net            Dworkin's Generic Driver + extra networking support + regexps
fpc-regexpr     devel/fpc-regexpr      Free Pascal regular expression routines
gnu-regexp      java/gnu-regexp        A regexp library for Java
gregexp         misc/gregexp           A graphical regular expression explorer
grepmail        mail/grepmail          Search mailboxes for a given regexp and display matching emails
jakarta-regexp  java/jakarta-regexp    Regular expressions for Java
libtre          textproc/libtre        A lightweight fully POSIX compliant regexp matching library
newsgrab        news/newsgrab          Download and uudecode binary files from USENET using regexps
p5-DelimMatch   textproc/p5-DelimMatch Perl extension to find regexp delimited strings with proper nesting
sarep           textproc/sarep         Command-line search and replace tool; written in Perl; handles regexps
tkregexp        misc/tkregexp          An interactive regexp design tool

Download makesubindex