Skip to content

Commit

Permalink
Merge pull request #9 from thedoc31/1.8
Browse files Browse the repository at this point in the history
Add Amazon Linux support
  • Loading branch information
DBezemer authored Mar 17, 2018
2 parents 6602959 + 5a7de65 commit 35d2742
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 9 deletions.
11 changes: 11 additions & 0 deletions SOURCES/haproxy.syslog.amzn1
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
$ModLoad imudp
$UDPServerAddress 127.0.0.1
$UDPServerRun 514

$template HAProxy,"%syslogtag%%msg:::drop-last-lf%\n"
$template TraditionalFormatWithPRI,"%pri-text%: %timegenerated% %syslogtag%%msg:::drop-last-lf%\n"

local2.=info /var/log/haproxy/access.log;HAProxy
local2.=notice;local2.=warning /var/log/haproxy/status.log;TraditionalFormatWithPRI
local2.error /var/log/haproxy/error.log;TraditionalFormatWithPRI
local2.* ~
25 changes: 16 additions & 9 deletions SPECS/haproxy.spec
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Group: System Environment/Daemons
URL: http://www.haproxy.org/
Source0: http://www.haproxy.org/download/1.8/src/%{name}-%{version}.tar.gz
Source1: %{name}.cfg
%{?amzn1:Source2: %{name}.init}
%{?el6:Source2: %{name}.init}
%{?el7:Source2: %{name}.service}
Source3: %{name}.logrotate
Expand All @@ -29,7 +30,7 @@ BuildRequires: pcre-devel make gcc openssl-devel

Requires(pre): shadow-utils

%if 0%{?el6}
%if 0%{?el6} || 0%{?amzn1}
Requires(post): chkconfig, initscripts
Requires(preun): chkconfig, initscripts
Requires(postun): initscripts
Expand Down Expand Up @@ -80,7 +81,7 @@ systemd_opts=

%install
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}

%{__install} -d %{buildroot}%{_sbindir}
%{__install} -d %{buildroot}%{_sysconfdir}/logrotate.d
%{__install} -d %{buildroot}%{_sysconfdir}/rsyslog.d
Expand All @@ -90,10 +91,10 @@ systemd_opts=
%{__install} -d %{buildroot}%{_mandir}/man1/

%{__install} -s %{name} %{buildroot}%{_sbindir}/
%if 0%{?el6}
%if 0%{?el6} || 0%{?amzn1}
%{__install} -d %{buildroot}%{_sysconfdir}/rc.d/init.d
%{__install} -c -m 755 %{SOURCE2} %{buildroot}%{_sysconfdir}/rc.d/init.d/%{name}
%endif
%endif
%if 0%{?el7}
%{__install} -s %{name} %{buildroot}%{_sbindir}/
%{__install} -p -D -m 0644 %{SOURCE2} %{buildroot}%{_unitdir}/%{name}.service
Expand All @@ -114,14 +115,14 @@ getent passwd %{haproxy_user} >/dev/null || \
useradd -u 188 -r -g %{haproxy_group} -d %{haproxy_home} \
-s /sbin/nologin -c "%{name}" %{haproxy_user}
exit 0

%post
%if 0%{?el7}
%systemd_post %{name}.service
systemctl restart rsyslog.service
%endif

%if 0%{?el6}
%if 0%{?el6} || 0%{?amzn1}
/sbin/chkconfig --add %{name}
/sbin/service rsyslog restart >/dev/null 2>&1 || :
%endif
Expand All @@ -131,7 +132,7 @@ systemctl restart rsyslog.service
%systemd_preun %{name}.service
%endif

%if 0%{?el6}
%if 0%{?el6} || 0%{?amzn1}
if [ $1 = 0 ]; then
/sbin/service %{name} stop >/dev/null 2>&1 || :
/sbin/chkconfig --del %{name}
Expand All @@ -144,7 +145,7 @@ fi
systemctl restart rsyslog.service
%endif

%if 0%{?el6}
%if 0%{?el6} || 0%{?amzn1}
if [ "$1" -ge "1" ]; then
/sbin/service %{name} condrestart >/dev/null 2>&1 || :
/sbin/service rsyslog restart >/dev/null 2>&1 || :
Expand All @@ -158,9 +159,12 @@ fi
%dir %{_localstatedir}/log/%{name}

%attr(0755,root,root) %{_sbindir}/%{name}
%if 0%{?amzn1}
%attr(0755,root,root) %config %_sysconfdir/rc.d/init.d/%{name}
%endif
%if 0%{?el6}
%attr(0755,root,root) %config %_sysconfdir/rc.d/init.d/%{name}
%endif
%endif
%if 0%{?el7}
%attr(0755,root,root) %{_sbindir}/%{name}
%attr(-,root,root) %{_unitdir}/%{name}.service
Expand All @@ -172,6 +176,9 @@ fi
%attr(0644,root,root) %config %{_sysconfdir}/rsyslog.d/49-%{name}.conf

%changelog
* Fri Feb 23 2018 J. Casalino <[email protected]>
- Add support for Amazon Linux (Fedora-based)

* Mon Jul 31 2017 David Bezemer <[email protected]>
- Update for HAproxy 1.7.8

Expand Down

0 comments on commit 35d2742

Please sign in to comment.