On Thursday 15 July 2004 01:58 pm, Nick Harring wrote:
> On Thu, 2004-07-15 at 13:31 -0500, Jeremy Kitchen wrote:
> > grep vpopmail /etc/passwd | awk -F ":" '{print $6}'
> >
> > or
> >
> > grep vpopmail /etc/passwd | cut -d':' -f6
>
> I'd go with awk, personally. Poking around my network a bit I'm finding
> cut on solaris and sco clients (and I know its on the *BSDs), however
> awk is a truly old school tool, and is almost gauranteed to be on all
> UNIX variants.

true.  I can also check for one or the other (rather clunky, but it works)
> > I appreciate any input (including if /etc/passwd is not portable, it's
[snip]
> /etc/passwd should be pretty portable however the field order I don't
> think is specified in any POSIX or equivalent spec. Depending on what
> info you're looking for you may want to see if something like perl's
> builtin getpw function would work (perldoc -f getpw) since they've
> ported perl to virtually every *nix on earth and have dealt with all of
> these shifting "standard" things.

argh, that's true.  Probably why djb didn't just write his own /etc/passwd 
parser when he complained about the reliability of getpwnam()

I will check around a little bit.  If only 'id' had a -h flag for home 
directory :)

I could have a simple C program get built that calls getpwnam() and returns 
the home directory ... ugh.... can we say kludge? :)

maybe I'll just make conf-vpopmail be the path to vpopmail's home directory 
and call it good.   T'would be nice to be able to auto-detect it simply based 
on the user vpopmail was configured with (considering there are probably far 
less vpopmail implementations that use another user than vpopmail, than there 
are ones that use something other than /home/vpopmail), but sometimes 
sacrifices must be made :)

I will do it this way, and add a check just before qmail-smtpd is built to 
make sure that $VPOPDIR/etc/{inc_deps,lib_deps} exist, and if not, spit out 
an error.

Thanks everyone for your input :)

-Jeremy

-- 
Jeremy Kitchen ++ Systems Administrator ++ Inter7 Internet Technologies, Inc.
  [EMAIL PROTECTED] ++ www.inter7.com ++ 866.528.3530 ++ 847.492.0470 int'l
        kitchen @ #qmail #gentoo on EFnet ++ scriptkitchen.com/qmail

Reply via email to