diff --git a/.gitignore b/.gitignore index e69de29..c438cbd 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/ahcpd-0.53.tar.gz diff --git a/ahcpd.conf b/ahcpd.conf new file mode 100644 index 0000000..a7da76b --- /dev/null +++ b/ahcpd.conf @@ -0,0 +1,11 @@ +mode server + +#prefix + +lease-dir /var/lib/ahcpd/leases/ + +#name-server ADDRESS + +#ntp-server ADDRESS + +#See man(8) ahcpd for complete configuration file options. diff --git a/ahcpd.logrotate b/ahcpd.logrotate new file mode 100644 index 0000000..5f56edf --- /dev/null +++ b/ahcpd.logrotate @@ -0,0 +1,7 @@ +/var/log/ahcpd.log { + missingok + weekly + rotate 4 + notifempty + create 0600 root root +} diff --git a/ahcpd.service b/ahcpd.service new file mode 100644 index 0000000..07fc3ca --- /dev/null +++ b/ahcpd.service @@ -0,0 +1,9 @@ +[Unit] +Description=ahcpd network configuration daemon +After=network.target + +[Service] +ExecStart=/usr/sbin/ahcpd -c /etc/ahcpd.conf p2p1 + +[Install] +WantedBy=multi-user.target diff --git a/ahcpd.spec b/ahcpd.spec new file mode 100644 index 0000000..3a68876 --- /dev/null +++ b/ahcpd.spec @@ -0,0 +1,82 @@ +%define _hardened_build 1 + +Name: ahcpd +Version: 0.53 +Release: 2%{?dist} +Summary: Ad-hoc network configuration daemon + +Group: System Environment/Base +License: MIT +URL: http://www.pps.univ-paris-diderot.fr/~jch/software/ahcp/ +Source0: http://www.pps.univ-paris-diderot.fr/~jch/software/files/%{name}-%{version}.tar.gz +Source1: %{name}.service +Source2: %{name}.conf +Source3: %{name}.logrotate +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +Requires(post): systemd-units +Requires(preun): systemd-units +Requires(postun): systemd-units + +%description +AHCP is a configuration protocol that can replace DHCP on networks without +transitive connectivity, such as mesh networks. + +%prep +%setup -q + +%build +make CFLAGS="$RPM_OPT_FLAGS" %{?_smp_mflags} + + +%install +rm -rf $RPM_BUILD_ROOT +install -Dpm 755 ahcpd $RPM_BUILD_ROOT%{_sbindir}/ahcpd +install -Dpm 644 %{SOURCE1} $RPM_BUILD_ROOT%{_unitdir}/%{name}.service +install -Dpm 644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/ahcpd.conf +install -Dpm 644 ahcpd.man $RPM_BUILD_ROOT/%{_mandir}/man8/ahcpd.8 +install -Dp -m 0644 %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/ahcpd +mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/lib/ahcpd/leases/ + +%clean +rm -rf $RPM_BUILD_ROOT + + +%post +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 ahcpd.service > /dev/null 2>&1 || : + /bin/systemctl stop ahcpd.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 ahcpd.service >/dev/null 2>&1 || : +fi + + +%files +%defattr(-,root,root,-) +%doc CHANGES LICENCE README +%{_sbindir}/ahcpd +%{_unitdir}/%{name}.service +%config(noreplace) %{_sysconfdir}/ahcpd.conf +%config(noreplace) %{_sysconfdir}/logrotate.d/ahcpd +%{_mandir}/man8/ahcpd.8.gz +%ghost %attr(0600,root,root) %{_localstatedir}/log/ahcpd.log + + +%changelog +* Mon Aug 27 2012 Jon Ciesla - 0.53-2 +- Dropped unneeded parts for review. +- Added log, logrotate, state file, and default config. + +* Tue Aug 21 2012 Jon Ciesla - 0.53-1 +- Initial package. \ No newline at end of file diff --git a/sources b/sources index e69de29..dad415b 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +a1a610bf20965aa522cd766bf3d5829a ahcpd-0.53.tar.gz