From owner-freebsd-questions@FreeBSD.ORG Mon Jun 2 17:21:17 2003 Return-Path: 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 E5CE637B401 for ; Mon, 2 Jun 2003 17:21:17 -0700 (PDT) Received: from falcon.mail.pas.earthlink.net (falcon.mail.pas.earthlink.net [207.217.120.74]) by mx1.FreeBSD.org (Postfix) with ESMTP id 44DF343F85 for ; Mon, 2 Jun 2003 17:21:17 -0700 (PDT) (envelope-from parv_fm@mailsent.net) Received: from sdn-ap-012dcwashp0399.dialsprint.net ([63.188.113.145] helo=moo.holy.cow) by falcon.mail.pas.earthlink.net with esmtp (Exim 3.33 #1) id 19MzYB-0001xi-00; Mon, 02 Jun 2003 17:21:16 -0700 Received: by moo.holy.cow (Postfix, from userid 1001) id F0764A72A; Mon, 2 Jun 2003 20:16:07 -0400 (EDT) Date: Mon, 2 Jun 2003 20:16:07 -0400 From: parv To: Adam Message-ID: <20030603001607.GA3613@moo.holy.cow> Mail-Followup-To: Adam , freebsd-questions@freebsd.org References: <1054590763.16970.5.camel@jake> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1054590763.16970.5.camel@jake> cc: freebsd-questions@freebsd.org Subject: Re: Listing installed ports without any ports dependent on it X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jun 2003 00:21:18 -0000 in message <1054590763.16970.5.camel@jake>, wrote Adam thusly... > > For each installed port that has NO other installed ports > dependent on it, output the full name of the port > > In other words, I want a script to generate the list of ports that > can be deinstalled without forcing (-f). What you need is to check if '+REQUIRED_BY' file exists. (For finer control, also check if it is empty or not.) If file does not exist (or is empty), then there is no registered dependency. #!/bin/sh pkgdb=/var/db/pkg for p in $pkgdb/* do [ -f "$p/+REQUIRED_BY" ] || { echo "$p" | sed -e "s!^$pkgdb/!!" ; } done - Parv -- A programmer, budding Unix system administrator, and amateur photographer ISO employment. Details... http://www103.pair.com/parv/work/