From f0957100c2f17666832a8477416fd810cee4fa2a Mon Sep 17 00:00:00 2001 From: Kevin Fenzi Date: Jan 29 2012 05:42:59 +0000 Subject: Convert to systemd. Fixes bug #737168 --- diff --git a/apg.socket b/apg.socket new file mode 100644 index 0000000..74fd012 --- /dev/null +++ b/apg.socket @@ -0,0 +1,9 @@ +[Unit] +Description=Apg Activation Socket + +[Socket] +ListenStream=129 +Accept=true + +[Install] +WantedBy=sockets.target diff --git a/apg.spec b/apg.spec index c8684e6..7a141d8 100644 --- a/apg.spec +++ b/apg.spec @@ -2,17 +2,22 @@ Summary: Automated Password Generator for random password generation Name: apg Version: 2.3.0b -Release: 12%{?dist} +Release: 13%{?dist} License: BSD Group: System Environment/Base URL: http://www.adel.nursat.kz/%{name}/ Source0: http://www.adel.nursat.kz/%{name}/download/%{name}-%{version}.tar.gz -Source1: apg.xinetd +Source1: apg.socket +Source2: apg@.service Patch0: apg-2.3.0b-gen_rand_pass.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +BuildRequires: systemd-units Requires(post): grep +Requires(post): systemd-units +Requires(preun): systemd-units +Requires(postun): systemd-units %description APG (Automated Password Generator) is the tool set for random password @@ -38,18 +43,38 @@ install -D apgd %{buildroot}%{_sbindir}/apgd install -D -m 644 doc/man/apg.1 %{buildroot}%{_mandir}/man1/apg.1 install -D -m 644 doc/man/apgbfm.1 %{buildroot}%{_mandir}/man1/apgbfm.1 install -D -m 644 doc/man/apgd.8 %{buildroot}%{_mandir}/man8/apgd.8 +install -d -m 755 %{buildroot}%{_unitdir} -install -D -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/xinetd.d/apgd +install -p -m 755 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.socket +install -p -m 755 %{SOURCE2} %{buildroot}%{_unitdir}/%{name}@.service %clean [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT %post # add a service for apg if it doesn't already exist -if ! grep -q ^pwdgen /etc/services; then +/bin/grep ^pwgen /etc/services >& /dev/null +if [ $? == 1 ]; then echo -e 'pwdgen\t\t129/tcp\t\t\t# PWDGEN service' >> /etc/services fi +if [ $1 -eq 1 ]; then + # Initial installation + /bin/systemctl daemon-reload >/dev/null 2>&1 || : +fi +%preun +if [ $1 -eq 0 ]; then + # Package removal, not upgrade + /bin/systemctl --no-reload disable apg@.service > /dev/null 2>&1 || : + /bin/systemctl stop apg@.service > /dev/null 2>&1 || : +fi + +%postun +/bin/systemctl daemon-reload >/dev/null 2>&1 || : +if [ $1 -ge 1 ] ; then + # Package upgrade, not uninstall + /bin/systemctl try-restart apg@.service >/dev/null 2>&1 || : +fi %files %defattr(-, root, root) @@ -58,9 +83,13 @@ fi %{_bindir}/apgbfm %{_sbindir}/apgd %{_mandir}/man*/* -%{_sysconfdir}/xinetd.d/apgd +%{_unitdir}/%{name}@.service +%{_unitdir}/%{name}.socket %changelog +* Sat Jan 28 2012 Kevin Fenzi 2.3.0b-13 +- Convert to use systemd instead of xinetd. Fixes bug #737168 + * Thu Jan 12 2012 Fedora Release Engineering - 2.3.0b-12 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild diff --git a/apg@.service b/apg@.service new file mode 100644 index 0000000..beafcb2 --- /dev/null +++ b/apg@.service @@ -0,0 +1,7 @@ +[Unit] +Description=Apgd Random Passwords Generator Server +After=local-fs.target + +[Service] +ExecStart=/usr/sbin/apgd -M sncl -EO -a 0 -r /usr/share/dict/words -m 8 -x 8 -t +StandardInput=socket