[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Removing *all* occurrences of a set of lines.
From: |
Jamie Wilkinson |
Subject: |
Re: Removing *all* occurrences of a set of lines. |
Date: |
Wed, 15 Jan 2003 09:28:41 +1100 |
User-agent: |
Internet Messaging Program (IMP) 3.1 |
Quoting Daniel Pittman <daniel@rimspace.net>:
> To manage /etc/hosts.allow[1],
> So, can anyone suggest a better way of implementing this?
Dunno if it's better, but I use this recipe for (ssh in) hosts.allow:
control:
locked_down_machines::
sshsources = ( .anchor.net.au )
!locked_down_machines::
sshsources = ( ALL )
editfiles:
any::
{ /etc/hosts.allow
Backup 'off'
BeginGroupIfNoLineMatching '^sshd:.*'
Append 'sshd:'
EndGroup
ResetSearch 1
LocateLineMatching '^sshd:.*'
ReplaceLineWith 'sshd: ${sshsources}'
}
I find myself using this construct for a lot of configuration files when I need
to check that the option exists and add it if necessary before setting the
value.
I think that a SetOption command in editfiles that takes a regex and then a
string that does all of this would be quite useful and reduce the complexity of
my scripts ;-)
Jamie