From owner-freebsd-questions@FreeBSD.ORG Mon Oct 3 16:55:31 2005 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 75F8516A41F for ; Mon, 3 Oct 2005 16:55:31 +0000 (GMT) (envelope-from e.schuele@computer.org) Received: from sccrmhc14.comcast.net (sccrmhc14.comcast.net [204.127.202.59]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1A10A43D46 for ; Mon, 3 Oct 2005 16:55:30 +0000 (GMT) (envelope-from e.schuele@computer.org) Received: from [192.168.1.111] (www.gtisd.com[208.206.151.6]) by comcast.net (sccrmhc14) with ESMTP id <2005100316552901400p4ps4e>; Mon, 3 Oct 2005 16:55:30 +0000 Message-ID: <43416280.80403@computer.org> Date: Mon, 03 Oct 2005 11:55:28 -0500 From: Eric Schuele User-Agent: Mozilla Thunderbird 1.0.7 (X11/20050930) X-Accept-Language: en-us, en MIME-Version: 1.0 To: FreeBSD Questions Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Determining what a port will install... (more than pretty-print-*) [Soln] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Oct 2005 16:55:31 -0000 Hello, Some time back I posted a question regarding how to determine what ports/packages would need to be installed on my machine when I install a new (new to the local machine) port. For example, if I do not presently have openoffice installed... what will get installed when I 'make install clean' it? Note that I want the differences between what is needed to build/run the port and what is already present on the machine. At the time no one responded with a clear way to do this... so I finally had a few minutes to write a script to do it for me. I thought someone else might find it useful... So I'm posting it here for comments and thoughts (be gentle, I'm new to awk). I find it useful, especially for laptops... which may have a small HDD and little memory. I generally try to install the minimum necessary to do my work. #! /bin/sh # Script to determine the differences between what is necessary for # a port, and what is already present on the local machine. make pretty-print-build-depends-list | \ awk '{ count = 0 pkgs = "" for(i=5; i<=NF-2; i++) { pkg = $i if (index(pkg, "\"") == 1) {pkg = substr(pkg, 2, length(pkg)-1)} if (index(pkg, "\"") > 1) {pkg = substr(pkg, 1, length(pkg)-1)} if ( system("pkg_info -e " pkg) == 1) { pkgs = pkgs " " pkg count++ } } if ( count ) { print "You need the following (build) perequisites:" print pkgs } else { print "All (build) prerequisites are present." } }' make pretty-print-run-depends-list | \ awk '{ count = 0 pkgs = "" for(i=5; i<=NF-2; i++) { pkg = $i if (index(pkg, "\"") == 1) {pkg = substr(pkg, 2, length(pkg)-1)} if (index(pkg, "\"") > 1) {pkg = substr(pkg, 1, length(pkg)-1)} if ( system("pkg_info -e " pkg) == 1) { pkgs = pkgs " " pkg count++ } } if ( count ) { print "You need the following (run) perequisites:" print pkgs } else { print "All (run) prerequisites are present." } }' -- Regards, Eric