Logwatch Configuration Override File

Richard L. Hamilton rlhamil at smart.net
Tue Dec 17 04:40:43 UTC 2024


One of the lines he showed was

>>    my $ConfigDir = "/opt/local/etc/logwatch";

Together with the prior "re-root" comment, that means instead of copying the file to /etc/logwatch/conf and editing it as desired, it should be put in /opt/local/etc/logwatch/conf.

Further consideration of the comments means that almost always, a MacPorts port would put files in /opt/local/etc/... that would normally go in /etc/....; ditto for /opt/local/var vs /var, and so on. Likewise, things that non-MacPorts installs of software that usually installs in /usr/local/... would tend to install in /opt/local/...  There might be slight variations or exceptions, but if you check those, you'll usually find the answer..

> On Dec 16, 2024, at 17:57, Michael Newman via macports-users <macports-users at lists.macports.org> wrote:
> 
> Mike
> 
> Thank you for taking the time to write such a detailed explanation. Unfortunately, dunce that I am, I didn’t understand most of it. I’m just a tool user and have little understanding of the code behind the tools that I use.
> 
> When I see something like this:
> 
> reinplace "s|@PREFIX@|${prefix}|g" ${worksrcpath}/scripts/logwatch.pl
> 
> My head spins.
> 
> Am I supposed to actually do all that stuff that I see when I run port cat logwatch?
> 
> Sorry for my ignorance.
> 
> Mike
> 
>> On Dec 16, 2024, at 19:00, macports-users-request at lists.macports.org wrote:
>> 
>> Date: Sun, 15 Dec 2024 19:04:21 -0800
>> From: Mike Cappella <mike at cappella.us <mailto:mike at cappella.us>>
>> To: macports-users at lists.macports.org <mailto:macports-users at lists.macports.org>
>> Subject: Re: Logwatch Configuration Override File
>> Message-ID: <77684C0A-5871-4FE0-8C8A-3A0E0A24A0DE at cappella.us <mailto:77684C0A-5871-4FE0-8C8A-3A0E0A24A0DE at cappella.us>>
>> Content-Type: text/plain; charset="utf-8"
>> 
>> 
>> 
>>> On Dec 15, 2024, at 5:48?PM, Michael Newman via macports-users <macports-users at lists.macports.org <mailto:macports-users at lists.macports.org>> wrote:
>>> 
>>> I've been running Logwatch on a Raspberry Pi for some time and learned a lot from it. I decided to install on a Mac (Intel iMac running Sequoia) via MacPorts.
>>> 
>>> The Logwatch configuration file:
>>> 
>>> /opt/local/share/logwatch/default.conf/logwatch.conf
>>> 
>>> says to override default variables by putting them in the following file:
>>> 
>>> /etc/logwatch/conf/logwatch.conf
>>> 
>>> However, that directory does not exist. So, I'm lost. Do I need to create that directory or does the override file go somewhere else?
>>> 
>> 
>> 
>> MacPorts doesn't pollute the macOS root, and re-roots everything (it can) under /opt/local (by default).
>> 
>> The port file has instructions to patch the downloaded, extracted archive, changing the default destination root.  You can see the final result in the logwatch.pl script.  You're trying to discover where some logwatch.conf file is located, so grep'ing for that yields:
>> 
>>    &ReadConfigFile ("$BaseDir/default.conf/logwatch.conf", "");
>>    &ReadConfigFile ("$BaseDir/dist.conf/logwatch.conf", "");
>>    &ReadConfigFile ("$ConfigDir/conf/logwatch.conf", "");
>> 
>> And searching for BaseDir and ConfigDir reveal the answer:
>> 
>>    my $BaseDir = "/opt/local/share/logwatch";
>>    my $ConfigDir = "/opt/local/etc/logwatch";
>> 
>> Later you see that it reads from the following config files:
>> 
>>    &ReadConfigFile ("$BaseDir/default.conf/logwatch.conf", "");
>>    &ReadConfigFile ("$BaseDir/dist.conf/logwatch.conf", "");
>>    &ReadConfigFile ("$ConfigDir/conf/logwatch.conf", "");
>>    &ReadConfigFile ("$ConfigDir/conf/override.conf", "logwatch");
>> 
>> The command "port cat" will show the port file:
>> 
>>    $ port cat logwatch
>> 
>> And you can see the see the instructions used to patch just before installaation.
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macports.org/pipermail/macports-users/attachments/20241216/eb9b3008/attachment.htm>


More information about the macports-users mailing list