Re: How to list default packages?

[email protected] (Paul Jarc)
Newsgroups gmane.comp.djb.package
Organization What did you have in mind? A short, blunt, human pyramid?
Message-ID <[email protected]>
Stefan Karrmann <[email protected]> wrote:
> How can I list all default packages of /package?

I don't know what you mean by "default", but you might be interested
in the code for sp-check.  It traverses /package and distinguishes
categories from packages.
<URL:http://multivac.cwru.edu./sptools/#sp-check>

> find /package -perm -1111 -prune lists all categories.

It doesn't find subcategories because of -prune (thus doesn't get past
/package itself, which is sticky); it doesn't find categories that are
not universally accessible; it doesn't find anything if /package is a
symlink.  (Use "/package/." to protect against that case.)  It also
can find regular files (rather, it would without -prune), although
there shouldn't normally be any, outside packages.

> find /package -perm -1110 -prune |

This finds files or directories that have at least the sticky bit, the
user-execute bit, and the group-execute bit.  I don't know what you
intended it to find, but I'm pretty sure it doesn't work.

> while read c; do find "$c" ! -perm +1000 -prune; done lists all packages.

"-perm +n" doesn't work on Solaris, at least.  But when
testing a single bit, "+" (or) is the same as "-" (and).

> find /package -perm -1111 -prune |
> while read c; do find "$c" ! -perm +1000 -prune; done |
> while read p
> do
>   test -l "$p" || continue
>   l=`readlink "$p"`
>   test -e `dirname "$p"`/"$l" || continue
>   echo "$l" |
>     grep -q ^`basename "$p"`-"[0-9]" &&
>       echo "$p"
> done

I don't understand what this is supposed to do, but "test" treats "-l"
(and sometimes "-e", depending on the platform) as an uninterpreted
string, not a file mode test.  Also, not every grep understands -q.


paul
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.