SHA256
1
0
forked from pool/atftp

Accepting request 286332 from home:posophe:branches:network

Systemd support

OBS-URL: https://build.opensuse.org/request/show/286332
OBS-URL: https://build.opensuse.org/package/show/network/atftp?expand=0&rev=22
This commit is contained in:
Marcus Meissner 2015-02-16 13:23:51 +00:00 committed by Git OBS Bridge
parent 9f1ef11be3
commit 58e155b9c9
4 changed files with 55 additions and 2 deletions

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Mon Feb 16 13:06:57 UTC 2015 - p.drouand@gmail.com
- Add systemd support for openSUSE >= 12.1
-------------------------------------------------------------------
Tue Nov 12 20:41:45 UTC 2013 - chris@computersalat.de

View File

@ -1,7 +1,7 @@
#
# spec file for package atftp
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -32,6 +32,8 @@ Source1: atftpd.init
Source2: atftpd.sysconfig
Source3: atftpd.logrotate
Source4: atftp.fw
Source5: atftpd.service
Source6: atftpd.socket
Patch1: atftp-0.7.dif
Patch2: atftp-CLK_TCK.diff
Patch3: atftp-0.7_compiler_warnings.patch
@ -52,7 +54,13 @@ Patch14: atftp-0.7-default_dir_man.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Provides: tftp(client)
Provides: tftp(server)
PreReq: %insserv_prereq %fillup_prereq
%if 0%{?suse_version} >= 1210
BuildRequires: systemd-rpm-macros
%{?systemd_requires}
%else
PreReq: %insserv_prereq
%endif
PreReq: %fillup_prereq
PreReq: pwdutils
BuildRequires: autoconf
BuildRequires: automake
@ -95,8 +103,14 @@ make %{?_smp_mflags}
%install
%makeinstall
# SuSE rc
%if 0%{?suse_version} >= 1210
%{__install} -D -m 0755 %{S:5} %{buildroot}/%{_unitdir}/atftpd.service
%{__install} -D -m 0755 %{S:6} %{buildroot}/%{_unitdir}/atftpd.socket
ln -s /usr/sbin/service %{buildroot}%{_sbindir}/rcatftpd
%else
%{__install} -D -m 0755 %{S:1} %{buildroot}/etc/init.d/atftpd
%{__ln_s} -f ../../etc/init.d/atftpd %{buildroot}%{_sbindir}/rcatftpd
%endif
%{__install} -D -m 0644 %{S:2} %{buildroot}/var/adm/fillup-templates/sysconfig.atftpd
%{__install} -D -m 0644 %{S:3} %{buildroot}/etc/logrotate.d/%{name}
%{__mkdir} -p %{buildroot}/%{_fwdefdir}
@ -117,16 +131,30 @@ if [ -f /etc/sysconfig/atftpd ]; then
%{__sed} -i -e "s@^\(ATFTPD_OPTIONS=\"--daemon \"\)@#\1@" /etc/sysconfig/atftpd
%{__sed} -i -e "s@^\(ATFTPD_DIRECTORY=\"/tftpboot\"\)@#\1@" /etc/sysconfig/atftpd
fi
%if 0%{?suse_version} >= 1210
%service_add_pre atftpd.service atftpd.socket
%endif
%preun
%if 0%{?suse_version} >= 1210
%service_del_preun atftpd.service atftpd.socket
%else
%stop_on_removal atftpd
%endif
%post
%if 0%{?suse_version} >= 1210
%service_add_post atftpd.service atftpd.socket
%endif
%{fillup_only -n atftpd}
%postun
%if 0%{?suse_version} >= 1210
%service_del_postun atftpd.service atftpd.socket
%else
%restart_on_update atftpd
%{insserv_cleanup}
%endif
%files
%defattr(-,root,root)
@ -135,7 +163,12 @@ fi
%{_sbindir}/atftpd
%{_sbindir}/in.tftpd
%{_sbindir}/rcatftpd
%if 0%{?suse_version} >= 1210
%{_unitdir}/atftpd.service
%{_unitdir}/atftpd.socket
%else
/etc/init.d/atftpd
%endif
%config /etc/logrotate.d/%{name}
/var/adm/fillup-templates/sysconfig.atftpd
%{_mandir}/man1/atftp.1.gz

7
atftpd.service Normal file
View File

@ -0,0 +1,7 @@
[Unit]
Description=Advanced TFTP Server
[Service]
EnvironmentFile=/etc/sysconfig/atftpd
ExecStart=/usr/sbin/atftpd --user $ATFTPD_USER --group $ATFTPD_GROUP $ATFTPD_OPTIONS $ATFTPD_DIRECTORY
StandardInput=socket

8
atftpd.socket Normal file
View File

@ -0,0 +1,8 @@
[Unit]
Description=Advanced tftp Server Activation Socket
[Socket]
ListenDatagram=69
[Install]
WantedBy=sockets.target