Name: pdagent License: GNU General Public License (GPL) - all versions Version: 1.4 Release: 1qg Summary: The PagerDuty Agent is a helper program. URL: http://www.pagerduty.com Source0: pdagent.tar.gz Source1: pdagent.service Source2: pdagent.tmpfiles.conf BuildRequires: python2 BuildRequires: systemd unzip BuildArch: noarch Requires: python2 BuildRoot: %{_tmppath}/%{name}-%{version}-build %description The PagerDuty Agent is a helper program that you install on your monitoring system to integrate your monitoring tools with PagerDuty." %prep %setup -q -n pdagent %build %install rm -rf $RPM_BUILD_ROOT mkdir -p $RPM_BUILD_ROOT/usr/ mkdir -p $RPM_BUILD_ROOT/etc/ mkdir -p $RPM_BUILD_ROOT/var/ cp -a etc/* $RPM_BUILD_ROOT/etc cp -a usr/* $RPM_BUILD_ROOT/usr cp -a var/* $RPM_BUILD_ROOT/var rm -fr $RPM_BUILD_ROOT/usr/lib/python2.6 rm -fr $RPM_BUILD_ROOT/etc/init.d #%{__mkdir} -p %{buildroot}%{_unitdir} %{__install} -D -m 444 %{S:1} %{buildroot}/usr/lib/systemd/system/pdagent.service %{__install} -D -m 644 %{S:2} %{buildroot}/usr/lib/tmpfiles.d/pdagent.conf %post /usr/bin/getent passwd pdagent >/dev/null || \ /usr/sbin/adduser --system --shell /bin/false --no-create-home pdagent chown -R pdagent:pdagent /var/lib/pdagent /var/log/pdagent chmod 750 /var/lib/pdagent/outqueue/err /var/lib/pdagent/outqueue/suc chmod 753 /var/lib/pdagent/outqueue/tmp /var/lib/pdagent/outqueue/pdq # VERSION=`python -c "import platform; print platform.python_version()"` # if [[ $VERSION == 2.7.* ]]; then # INSTALL_PATH="/usr/lib/python2.7/site-packages/pdagent" # python2.7 -m compileall -q -f "$INSTALL_PATH/" # else # INSTALL_PATH="/usr/lib/python2.6/site-packages/pdagent" # python2.6 -m compileall -q -f "$INSTALL_PATH/" # fi # %systemd_post %{name}.service %preun %systemd_preun %{name}.service %postun # VERSION=`python -c "import platform; print platform.python_version()"` # if [[ $VERSION == 2.7.* ]]; then # find /usr/lib/python2.7/site-packages/pdagent/ \ # -name "*.pyc" -exec rm {} \; # else # find /usr/lib/python2.6/site-packages/pdagent/ \ # -name "*.pyc" -exec rm {} \; # fi %systemd_postun_with_restart %{name}.service %files %defattr(-,root,root,-) %config(noreplace) /etc/pdagent.conf # %dir /var/log/%{name} # %dir /var/lib/%{name} # %dir %{_datadir}/%{name} # %dir /usr/bin/ # %dir /usr/share/%{name}/bin # #%dir /usr/lib/python2.6/site-packages/%{name} # %dir /usr/lib/python2.7/site-packages/%{name} %{_datadir}/%{name} /var/log/%{name} /var/lib/%{name} /usr/bin/* /usr/share/%{name}/bin/* #/usr/lib/python2.6/site-packages/%{name} /usr/lib/python2.7/site-packages/%{name} /usr/lib/tmpfiles.d/pdagent.conf /usr/lib/systemd/system/pdagent.service #%{_unitdir}/%{name}.service