Skip to content

Commit

Permalink
apache2: fix overwriting of .conf files. Take 2
Browse files Browse the repository at this point in the history
use apache2.sysconfdir in post-activate phase
  • Loading branch information
Schamschula committed Oct 18, 2017
1 parent 6bcf8b3 commit d5d250b
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions www/apache2/Portfile
Expand Up @@ -98,6 +98,10 @@ post-destroot {

move ${destroot}${apache2.sysconfdir}/httpd.conf \
${destroot}${apache2.sysconfdir}/httpd.conf.orig
foreach f [glob -tails -directory ${destroot}${apache2.sysconfdir}/extra/ *] {
move ${destroot}${apache2.sysconfdir}/extra/${f} \
${destroot}${apache2.sysconfdir}/extra/${f}.orig
}

xinstall -m 755 -d ${destroot}${apache2.datadir}
xinstall -m 755 -d ${destroot}${apache2.runtimedir}
Expand Down Expand Up @@ -125,26 +129,13 @@ pre-activate {
}
}
}

# back up configuration files
set systemTime [clock seconds]
set date_str [clock format ${systemTime} -format {%Y%m%d}]
copy ${apache2.sysconfdir}/httpd.conf ${apache2.sysconfdir}/httpd.conf.${date_str}
foreach f "httpd-autoindex.conf httpd-dav.conf httpd-default.conf \
httpd-fcgid.conf httpd-info.conf httpd-languages.conf \
httpd-manual.conf httpd-mpm.conf httpd-multilang-errordoc.conf \
httpd-ssl.conf httpd-userdir.conf httpd-vhosts.conf \
proxy-html.conf" {
copy ${apache2.sysconfdir}/extra/${f} ${apache2.sysconfdir}/extra/${f}.${date_str}
}
}

post-activate {
set confDir ${prefix}/etc/${name}
if {![file exists ${confDir}/httpd.conf]} {
file copy ${confDir}/httpd.conf.orig ${confDir}/httpd.conf
if {![file exists ${apache2.sysconfdir}/httpd.conf]} {
file copy ${apache2.sysconfdir}/httpd.conf.orig ${confDir}/httpd.conf

This comment has been minimized.

Copy link
@hostep

hostep Oct 19, 2017

@Schamschula: is it possible that you forgot to rename the second {confDir} variable on this line?
Because we are getting this error while trying to install apache2:

...
--->  Extracting apache2
--->  Applying patches to apache2
--->  Configuring apache2
--->  Building apache2
--->  Staging apache2 into destroot
--->  Creating launchd control script
###########################################################
# A startup item has been generated that will aid in
# starting apache2 with launchd. It is disabled
# by default. Execute the following command to start it,
# and to cause it to launch at startup:
#
# sudo port load apache2
###########################################################
--->  Installing apache2 @2.4.28_1+eventmpm
--->  Activating apache2 @2.4.28_1+eventmpm
Error: Failed to activate apache2: can't read "confDir": no such variable
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_www_apache2/apache2/main.log for details.
Error: Follow https://guide.macports.org/#project.tickets to report a bug.
Error: Processing of port apache2 failed

Thanks!

This comment has been minimized.

Copy link
@Schamschula

Schamschula via email Oct 19, 2017

Author Contributor
reinplace "s|#LoadModule slotmem_shm_module|LoadModule slotmem_shm_module|g" \
${confDir}/httpd.conf
${apache2.sysconfdir}/httpd.conf
}

#
Expand Down

1 comment on commit d5d250b

@Schamschula
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 62b65b6

Please sign in to comment.