What is policy about auto-editing config files on port install / deinstall?

Scot Hetzel swhetzel at gmail.com
Fri Jan 4 15:52:28 UTC 2013


On Fri, Jan 4, 2013 at 3:25 AM, olli hauer <ohauer at gmx.de> wrote:
>>> 456     @${ECHO} "@unexec ${SED} -i '' -E
>>> '/LoadModule[[:blank:]]+%%AP_NAME%%_module/d'
>>> %D/%%APACHEETCDIR%%/httpd.conf" >> ${PLIST}
>>
>> Found the reason for this sed line, as it is used to remove the
>> LoadModule line from the httpd.conf file so that when Apache is
>> uninstalled, the httpd.conf could be removed, if there were no changes
>> from the original.
>>
>> see http://svnweb.freebsd.org/ports?view=revision&revision=194395
>>
>> I still think it is better to disable the module on uninstall, and
>> enable the module on install.
>>
>
> Hi Scot,
>
> have you also read the commit log?
> - Fix leftover httpd.conf for AP_GEN_PLIST using ports.  The problem is that
>   apxs does not remove module line from httpd.conf, it merely comments it out.
>   Later, on Apache deinstall, the file differs from stock httpd.conf and is not
>   deleted.
>

I had read the commit log and still think it is wrong to remove the
LoadModule lines from the httpd.conf file, as the LoadModule line may
not be the only change to the httpd.conf file for that module.

How difficult would it be to create 2 temp files by striping all the
comments out of the httpd.conf* files, then compare those files to
determine if httpd.conf should be removed.

> The issue is the following.
> In case the LoadModule line is not removed from httpd.conf the port will be marked as broken by the ports build system.
>
>
> I'm thinking about an parameter which change the semantic in bsd.apache.mk so the module can be installed enabled.
> For example the following will do that (quick hack)
>
> Index: bsd.apache.mk
> ===================================================================
> --- bsd.apache.mk       (revision 309921)
> +++ bsd.apache.mk       (working copy)
> @@ -455,7 +445,11 @@
>  # apache22
>         @${ECHO} "@unexec ${SED} -i '' -E '/LoadModule[[:blank:]]+%%AP_NAME%%_module/d' %D/%%APACHEETCDIR%%/httpd.conf" >> ${PLIST}
>         @${ECHO} "%%APACHEMODDIR%%/%%AP_MODULE%%" >> ${PLIST}
> +.if defined(AP_MODENABLE)
> +       @${ECHO} "@exec %D/sbin/apxs -e -a -n %%AP_NAME%% %D/%F" >> ${PLIST}
> +.else
>         @${ECHO} "@exec %D/sbin/apxs -e -A -n %%AP_NAME%% %D/%F" >> ${PLIST}
> +.endif
>         @${ECHO} "@unexec echo \"Don't forget to remove all ${MODULENAME}-related directives in your httpd.conf\"">> ${PLIST}
>  .      endif
>  .else
>
>


That could work, how about putting a .if !defined(AP_MODENABLE) ..
.endif around the SED line, and adding @unexec %D/sbin/apxs -e -A -n
%%AP_NAME%% %D/%F" >> ${PLIST} in the .if defined(AP_MODENABLE) ..
.else.

Of course the do-install target would also need to be changed to have
.if defined(AP_MODENABLE) enable module .else disable module .endif
upon install.

-- 
DISCLAIMER:

No electrons were maimed while sending this message. Only slightly bruised.


More information about the freebsd-ports mailing list