Skip to content

Commit

Permalink
Add initial macros for apache httpd mods/configs
Browse files Browse the repository at this point in the history
  • Loading branch information
Conan-Kudo committed Jan 10, 2020
1 parent 368506b commit 3dbd986
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
5 changes: 5 additions & 0 deletions debbuild-macros.spec
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ Provides: perl-deb-macros
Provides: debbuild-macros-golang
Provides: go-deb-macros
Provides: golang-deb-macros
# Provides apache httpd macros
Provides: debbuild-macros-apache2
Provides: apache2-deb-macros

%if 0%{?debian} >= 8 || 0%{?ubuntu} >= 1504
# Provides systemd macros
Expand Down Expand Up @@ -75,6 +78,7 @@ install -pm 0644 macros.python2 %{buildroot}%{_debmacrodir}/macros.python2
install -pm 0644 macros.python3 %{buildroot}%{_debmacrodir}/macros.python3
install -pm 0644 macros.perl %{buildroot}%{_debmacrodir}/macros.perl
install -pm 0644 macros.golang %{buildroot}%{_debmacrodir}/macros.golang
install -pm 0644 macros.apache2 %{buildroot}%{_debmacrodir}/macros.apache2


%if 0%{?debian} >= 8 || 0%{?ubuntu} >= 1504
Expand All @@ -91,6 +95,7 @@ install -pm 0644 macros.systemd %{buildroot}%{_debmacrodir}/macros.systemd
%{_debmacrodir}/macros.python*
%{_debmacrodir}/macros.perl
%{_debmacrodir}/macros.golang
%{_debmacrodir}/macros.apache2
%if 0%{?debian} >= 8 || 0%{?ubuntu} >= 1504
%{_debmacrodir}/macros.systemd
%endif
Expand Down
54 changes: 54 additions & 0 deletions macros.apache2
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# SPDX-License-Identifier: MIT

%apache2_apxs %{_bindir}/apxs2
%apache2_mmn %(%{apache2_apxs} -q HTTPD_MMN)
%apache2_modconfdir %{_sysconfdir}/apache2/mods-available
%apache2_confdir %{_sysconfdir}/apache2/conf-available
%apache2_contentdir %{_datadir}/apache2
%apache2_moddir %{_libexecdir}/apache2/modules

# Fedora-ish names for compatibility
%_httpd_mmn %{apache2_mmn}
%_httpd_apxs %{apache2_apxs}
%_httpd_modconfdir %{apache2_modconfdir}
%_httpd_confdir %{apache2_confdir}
%_httpd_contentdir %{apache2_contentdir}
%_httpd_moddir %{apache2_moddir}


%apache2_module_post() \
if [ "$1" = "configure" ] ; then \
# Initial installation \
a2enmod %{1} >/dev/null 2>&1 || : \
fi \
%{nil}

%apache2_module_preun() \
if [ "$1" = "remove" ]; then \
# Package removal, not upgrade \
a2dismod %{1} > /dev/null 2>&1 || : \
fi \
if [ "$1" = "purge" ]; then \
# Package removal, not upgrade \
a2dismod -p %{1} > /dev/null 2>&1 || : \
fi \
%{nil}

%apache2_conf_post() \
if [ "$1" = "configure" ] ; then \
# Initial installation \
a2enconf %{1} >/dev/null 2>&1 || : \
fi \
%{nil}

%apache2_conf_preun() \
if [ "$1" = "remove" ]; then \
# Package removal, not upgrade \
a2disconf %{1} > /dev/null 2>&1 || : \
fi \
if [ "$1" = "purge" ]; then \
# Package removal, not upgrade \
a2disconf -p %{1} > /dev/null 2>&1 || : \
fi \
%{nil}

0 comments on commit 3dbd986

Please sign in to comment.