Re: [vchkpw] [semi-OT] which is more portable?

2004-07-15 Thread Tom Collins
On Jul 15, 2004, at 11:31 AM, Jeremy Kitchen wrote:
grep vpopmail /etc/passwd | awk -F ":" '{print $6}'
or
grep vpopmail /etc/passwd | cut -d':' -f6
How portable is this:
X=`cd ~vpopmail; pwd`
--
Tom Collins  -  [EMAIL PROTECTED]
QmailAdmin: http://qmailadmin.sf.net/  Vpopmail: http://vpopmail.sf.net/
Info on the Sniffter hand-held Network Tester: http://sniffter.com/


Re: [vchkpw] [semi-OT] which is more portable?

2004-07-15 Thread Chris Ess
[snip]

> right, which is why it's better to just specify it in conf-vpopmail.
> However, I'm having trouble getting that value into a variable in a
> Makefile, so I'm thinking that just setting it at the top and pointing
> documentation to change it would be best.

Why not just use the backtick substitutions like you pointed out djb does?
This gets around dealing with Makefile variables and prevents people from
needing to edit the Makefile.

Sincerely,


Chris Ess
System Administrator / CDTT (Certified Duct Tape Technician)


Re: [vchkpw] [semi-OT] which is more portable?

2004-07-15 Thread Jeremy Kitchen
On Thursday 15 July 2004 02:48 pm, Eric Ziegast wrote:
> > 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
>
> There's no rule that says that the base vpopmail dir has to be the
> home dir of user vpopmail.  You could compile a "vconfig" program
> first in C and use that program later in your install process.

right, which is why it's better to just specify it in conf-vpopmail.  However, 
I'm having trouble getting that value into a variable in a Makefile, so I'm 
thinking that just setting it at the top and pointing documentation to change 
it would be best.

-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



Re: [vchkpw] [semi-OT] which is more portable?

2004-07-15 Thread Eric Ziegast
Oops, sorry, didn't mean for that to go to the list.

--
Eric Ziegast


Re: [vchkpw] [semi-OT] which is more portable?

2004-07-15 Thread Eric Ziegast
> 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

There's no rule that says that the base vpopmail dir has to be the
home dir of user vpopmail.  You could compile a "vconfig" program
first in C and use that program later in your install process.

--
Eric Ziegast


Re: [vchkpw] [semi-OT] which is more portable?

2004-07-15 Thread Jeremy Kitchen
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



Re: [vchkpw] [semi-OT] which is more portable?

2004-07-15 Thread Jeremy Kitchen
On Thursday 15 July 2004 01:51 pm, Chris Ess wrote:
> > > grep vpopmail /etc/passwd | awk -F ":" '{print $6}'
> > >
> > > or
> > >
> > > grep vpopmail /etc/passwd | cut -d':' -f6
>
> I would think that cut would be more portable.  However, every machine
> I've used has had some variant of awk installed too.

ok, my initial intent was to use cut, so I think I'll stick with that.

> You might want to consider using 'grep ^vpopmail' or even 'grep
> ^vpopmail:' rather than 'grep vpopmail' to ensure that you're only getting
> the 'vpopmail' user.

good catch.  Change made.  The beauty of the open source community is shown :)

> (I have a server in which we've had to transparently 
> migrate users who were set up under sendmail so we have users whose home
> directories are under the vpopmail directory.  Nasty, I know.)  The one
> catch is that I don't know if 'grep ^string' is supported in all versions
> of 'grep'.

POSIX regular expressions should be portable to any POSIX conforming unix 
variant.  I would think that any implementation of grep would be able to 
handle that simple regex.

> > also, while on the topic of portability, I noticed that djb does not
> > include ANY variable substitutions (only backtick ` ` substitutions) in
> > his Makefile. I'm curious if this is also for portability reasons. 
> > Anyone aware of any implementations of the 'make' program that don't
> > understand variable substitions in Makefiles, or any situations (lack of
> > /bin/sh compatible shell, perhaps?) that might make variable
> > substitutions not possible?
>
> I don't know of any portability concerns in this regard.  I wonder if this
> is just a design choice.

could be, although I know djb went to great lenghts to make his code as 
absolutely portable as possible, and I don't want to stray from this :)

Thanks Chris.

-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



Re: [vchkpw] [semi-OT] which is more portable?

2004-07-15 Thread Nick Harring
Title: Re: [vchkpw] [semi-OT] which is more portable?






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. 

> I appreciate any input (including if /etc/passwd is not portable, it's
> been on  
> every system I've ever seen, but I'm relatively new to *nix compared
> to a lot  
> of you I'm sure) I can get :)
/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.
> 
> Thanks.
> 
> -Jeremy
> 
> --  
Hope that helps,
Nick
-- 
==
Nicholas Harring
System Administrator
Webley Systems
Ph/Fax/VM#877-609-4795
Email: [EMAIL PROTECTED]





Re: [vchkpw] [semi-OT] which is more portable?

2004-07-15 Thread Chris Ess
> > grep vpopmail /etc/passwd | awk -F ":" '{print $6}'
> >
> > or
> >
> > grep vpopmail /etc/passwd | cut -d':' -f6

I would think that cut would be more portable.  However, every machine
I've used has had some variant of awk installed too.

You might want to consider using 'grep ^vpopmail' or even 'grep
^vpopmail:' rather than 'grep vpopmail' to ensure that you're only getting
the 'vpopmail' user.  (I have a server in which we've had to transparently
migrate users who were set up under sendmail so we have users whose home
directories are under the vpopmail directory.  Nasty, I know.)  The one
catch is that I don't know if 'grep ^string' is supported in all versions
of 'grep'.

> > Reason I'm asking is I'm making some minor modifications to the Makefile
> > for the chkuser patch and I want to make sure they're as absolutely
> > portable as possible before releasing it to the masses.
>
> also, while on the topic of portability, I noticed that djb does not include
> ANY variable substitutions (only backtick ` ` substitutions) in his Makefile.
> I'm curious if this is also for portability reasons.  Anyone aware of any
> implementations of the 'make' program that don't understand variable
> substitions in Makefiles, or any situations (lack of /bin/sh compatible
> shell, perhaps?) that might make variable substitutions not possible?

I don't know of any portability concerns in this regard.  I wonder if this
is just a design choice.

Sincerely,


Chris Ess
System Administrator / CDTT (Certified Duct Tape Technician)


Re: [vchkpw] [semi-OT] which is more portable?

2004-07-15 Thread Jeremy Kitchen
On Thursday 15 July 2004 01:31 pm, Jeremy Kitchen wrote:
> grep vpopmail /etc/passwd | awk -F ":" '{print $6}'
>
> or
>
> grep vpopmail /etc/passwd | cut -d':' -f6
>
> Reason I'm asking is I'm making some minor modifications to the Makefile
> for the chkuser patch and I want to make sure they're as absolutely
> portable as possible before releasing it to the masses.

also, while on the topic of portability, I noticed that djb does not include 
ANY variable substitutions (only backtick ` ` substitutions) in his Makefile.  
I'm curious if this is also for portability reasons.  Anyone aware of any 
implementations of the 'make' program that don't understand variable 
substitions in Makefiles, or any situations (lack of /bin/sh compatible 
shell, perhaps?) that might make variable substitutions not possible?

Thanks again :)

-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



[vchkpw] [semi-OT] which is more portable?

2004-07-15 Thread Jeremy Kitchen
grep vpopmail /etc/passwd | awk -F ":" '{print $6}'

or 

grep vpopmail /etc/passwd | cut -d':' -f6

Reason I'm asking is I'm making some minor modifications to the Makefile for 
the chkuser patch and I want to make sure they're as absolutely portable as 
possible before releasing it to the masses.

I appreciate any input (including if /etc/passwd is not portable, it's been on 
every system I've ever seen, but I'm relatively new to *nix compared to a lot 
of you I'm sure) I can get :)

Thanks.

-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