From 112d0122641849964a557291b1a886ceacdd1a583de4d0d9461cd7d1914855c5 Mon Sep 17 00:00:00 2001
From: Christian Wittmer <chris@computersalat.de>
Date: Mon, 17 Mar 2014 19:33:45 +0000
Subject: [PATCH] Accepting request 226496 from
 home:computersalat:devel:network

fix for fix for bnc#844183

OBS-URL: https://build.opensuse.org/request/show/226496
OBS-URL: https://build.opensuse.org/package/show/network/proftpd?expand=0&rev=27
---
 proftpd.changes |  6 +++---
 proftpd.service |  1 -
 proftpd.spec    | 22 ++++++++++------------
 proftpd.tmpfile |  2 ++
 4 files changed, 15 insertions(+), 16 deletions(-)
 create mode 100644 proftpd.tmpfile

diff --git a/proftpd.changes b/proftpd.changes
index 0dc9789..499f89f 100644
--- a/proftpd.changes
+++ b/proftpd.changes
@@ -1,10 +1,10 @@
 -------------------------------------------------------------------
-Fri Mar 14 21:35:47 UTC 2014 - chris@computersalat.de
+Mon Mar 17 18:38:53 UTC 2014 - chris@computersalat.de
 
 - fix for bnc#844183
   * proftpd fails to start due to missing /run/proftpd
-    was created by 'init' file before start, somehow missed to add
-    to systemd service file
+- add own tmpfiles.d file 
+  * proftpd.tmpfile
 
 -------------------------------------------------------------------
 Thu Oct  3 20:48:44 UTC 2013 - chris@computersalat.de
diff --git a/proftpd.service b/proftpd.service
index 91a9e5e..a6bcc05 100644
--- a/proftpd.service
+++ b/proftpd.service
@@ -3,7 +3,6 @@ Description=ProFTPd FTP server
 After=systemd-user-sessions.service network.target nss-lookup.target local-fs.target remote-fs.target
 
 [Service]
-ExecStartPre=-/usr/bin/install -d /run/proftpd
 ExecStart=/usr/sbin/proftpd --nodaemon
 ExecReload=/bin/kill -HUP $MAINPID
 
diff --git a/proftpd.spec b/proftpd.spec
index 0888399..2f40ff6 100644
--- a/proftpd.spec
+++ b/proftpd.spec
@@ -30,6 +30,7 @@ Source1:        ftp://ftp.proftpd.org/distrib/source/%{name}-%{version}.tar.gz.a
 Source11:       %{name}.init
 Source12:       %{name}.passwd
 Source13:       %{name}.service
+Source14:       %{name}.tmpfile
 Source15:       %{name}.keyring
 #PATCH-FIX-openSUSE: pam, logrotate, xinet
 Patch100:       %{name}-dist.patch
@@ -194,8 +195,8 @@ export CXXFLAGS="$CFLAGS"
 
 %if 0%{?has_systemd}
 %{__install} -D -m 0644 %{S:13} %{buildroot}%{_unitdir}/%{name}.service
-# systemd need to create a tmp dir: /var/run/proftpd
-install -D -m 0644 contrib/dist/rpm/proftpd-tmpfs.conf %{buildroot}%{_prefix}/lib/tmpfiles.d/proftpd.conf
+# systemd need to create a tmp dir: /run/proftpd
+%{__install} -D -m 0644 %{S:14} %{buildroot}%{_prefix}/lib/tmpfiles.d/%{name}.conf
 %endif
 
 %find_lang %{name}
@@ -219,14 +220,13 @@ install -D -m 0644 contrib/dist/rpm/proftpd-tmpfs.conf %{buildroot}%{_prefix}/li
 %post
 # on `rpm -ivh` PARAM is 1
 # on `rpm -Uvh` PARAM is 2
-#if [ "$1" = "1" ]; then
-#  #%{__sed} -i "s,\(.*disable.*=\ \)no,\1yes," %{_sysconfdir}/xinetd.d/%{name}
-#  %{__sed} -i -e "s/@HOST@/$(hostname -s)/" %{_sysconfdir}/%{name}/%{name}.conf
-#fi
-%{fillup_and_insserv -f proftpd}
-
 %if 0%{?has_systemd}
 %service_add_post %{name}.service
+
+%{__install} -d /run/%{name}
+%else
+%{fillup_and_insserv -f proftpd}
+%{__install} -d %{_localstatedir}/run/%{name}
 %endif
 
 %postun
@@ -277,9 +277,6 @@ fi
 %config(noreplace) %{_sysconfdir}/%{name}/dhparams.pem
 %{_sysconfdir}/init.d/%{name}
 %dir %attr(0750,ftp,ftp) %{_localstatedir}/log/%{name}
-%if ! 0%{?has_systemd}
-%ghost %{_localstatedir}/run/%{name}
-%endif
 %{_sbindir}/*
 %{_mandir}/man?/*
 %dir %attr(0755,root,root) %{_libdir}/%{name}/
@@ -291,7 +288,8 @@ fi
 %exclude %{_libdir}/%{name}/mod_sql_sqlite.so
 %if 0%{?has_systemd}
 %{_unitdir}/%{name}.service
-%{_prefix}/lib/tmpfiles.d/proftpd.conf
+%{_prefix}/lib/tmpfiles.d/%{name}.conf
+%ghost %dir /run/%{name}
 %endif
 
 %files devel
diff --git a/proftpd.tmpfile b/proftpd.tmpfile
new file mode 100644
index 0000000..6d4dba0
--- /dev/null
+++ b/proftpd.tmpfile
@@ -0,0 +1,2 @@
+# proFTPD needs a DIR
+d /run/proftpd 0755 root root -