-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
David,
you're totally right with your asumptions. Gosh, two years of writing perl
scripts and I cannot even say what a tiny AWK expression is going to do,
shame on me! :-(
Well, we could easily replace that with a bash script. Bash supports regular
expressions since 3.0 (afaik), so it's easy to implement. It could go like
this:
if [[ -n "$DNSDOMAIN" ]] && [[ -f "/etc/resolv.conf" ]]
then
touch /tmp/resolv.conf.tmp
while read line
do
if [[ "$line" =~ "domain.*" ]]
then
echo "domain $DNSDOMAIN" >> /tmp/resolv.conf.tmp
else
echo "$line" >> /tmp/resolv.conf.tmp
fi
done < "/etc/resolv.conf"
mv /tmp/resolv.conf.tmp /etc/resolv.conf
fi
I don't know whether mv is stored in /usr/bin or in /bin, here, it's in /bin.
Staying bash ver 2.05 conformant would be possible, too.
HTH,
Eric
- ------ Original Message ------
Sender: David Paleino <[EMAIL PROTECTED]>
Recipient: [email protected]
Date: Saturday 03 February 2007 20:48
Subject: Re: [Initng] [InitNG] #477: we fail again with /usr on a different
partition
> Hello all,
> I'm a "normal" InitNG user (I mean, I'm not developing it), but I follow
> this ML. I've tried to figure out what that AWK command does. I actually
> have initng 0.6.7(-1) on my Debian, and the line in
> /etc/initng/system/domainname.i was:
>
> /usr/bin/awk '$1=="domain"&&ARGV[2]!=""{$2=ARGV[2]}{print}'
> /etc/resolv.conf "${DNSDOMAIN}"
>
> This line does the following (in pseudo code):
>
> if (($1 == "domain") && (ARGV[2] != "")) {
> $2 = ARGV[2];
> print;
> }
>
> Now, what are those $1 and $2? They are the words awk strips out from
> /etc/resolv.conf. My resolv.conf is:
>
> nameserver 208.67.222.222
> nameserver 208.67.220.220
>
> Now, awk takes as default "word separator" the space character.
> Therefore, in my resolv.conf, $1 would be "nameserver" and $2 would be
> the ip address, for each single line.
>
> That awk script, definitely, does the following: checks if the line
> begins with "domain", if it does, it checks that $DNSDOMAIN is not empty
> (ARGV[2]!=""). If it is not, it sets $2 to that $DNSDOMAIN, and prints
> the edited lines.
>
> My two cents,
> David
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
iD4DBQFFxQ0xMpEdE19y46cRAkKFAJ4tPKZsjoWRX5QBVrr/Jl2zNpHBrwCXU1Td
4XSOpulosBC7gcYOGa4Fdg==
=NYoS
-----END PGP SIGNATURE-----
--
_______________________________________________
Initng mailing list
[email protected]
http://jw.dyndns.org/mailman/listinfo/initng