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-requ...@lists.macports.org wrote:
> 
> Date: Sun, 15 Dec 2024 19:04:21 -0800
> From: Mike Cappella <m...@cappella.us <mailto:m...@cappella.us>>
> To: macports-users@lists.macports.org 
> <mailto:macports-users@lists.macports.org>
> Subject: Re: Logwatch Configuration Override File
> Message-ID: <77684c0a-5871-4fe0-8c8a-3a0e0a24a...@cappella.us 
> <mailto:77684c0a-5871-4fe0-8c8a-3a0e0a24a...@cappella.us>>
> Content-Type: text/plain; charset="utf-8"
> 
> 
> 
>> On Dec 15, 2024, at 5:48?PM, Michael Newman via macports-users 
>> <macports-users@lists.macports.org 
>> <mailto:macports-users@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.

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to