Listing installed ports without any ports dependent on it

parv parv_fm at emailgroups.net
Mon Jun 2 17:21:18 PDT 2003


in message <1054590763.16970.5.camel at 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/



More information about the freebsd-questions mailing list