diff --git a/epmd.service b/epmd.service new file mode 100644 index 0000000..0de780b --- /dev/null +++ b/epmd.service @@ -0,0 +1,11 @@ +[Unit] +Description=Erlang Port Mapper Daemon + +[Service] +EnvironmentFile=/etc/sysconfig/epmd +ExecStart=/usr/bin/epmd -daemon $EPMD_OPTS +ExecStop=/usr/bin/epmd -kill +Type=forking + +[Install] +WantedBy=multi-user.target diff --git a/epmd.socket b/epmd.socket new file mode 100644 index 0000000..9c0c297 --- /dev/null +++ b/epmd.socket @@ -0,0 +1,9 @@ +[Unit] +Conflicts=epmd.service + +[Socket] +ListenStream=4369 +Accept=no + +[Install] +WantedBy=sockets.target diff --git a/erlang.changes b/erlang.changes index 37d9f0f..8b28f7e 100644 --- a/erlang.changes +++ b/erlang.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Sun Oct 27 17:07:46 UTC 2013 - p.drouand@gmail.com + +- Add systemd support for openSUSE >= 12.3 + ------------------------------------------------------------------- Thu Sep 19 06:13:18 UTC 2013 - matwey.kornilov@gmail.com diff --git a/erlang.spec b/erlang.spec index ab45220..5202404 100644 --- a/erlang.spec +++ b/erlang.spec @@ -33,6 +33,8 @@ Source3: %{name}-rpmlintrc Source4: epmd.init Source5: erlang.sysconfig Source6: macros.erlang +Source7: epmd.service +Source8: epmd.socket # PATCH-MISSING-TAG -- See http://en.opensuse.org/openSUSE:Packaging_Patches_guidelines Patch0: otp-R16B-rpath.patch # PATCH-MISSING-TAG -- See http://en.opensuse.org/openSUSE:Packaging_Patches_guidelines @@ -54,12 +56,8 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: Mesa-devel BuildRequires: java-devel >= 1.6.0 BuildRequires: krb5-devel -%if 0%{?sles_version} >= 10 BuildRequires: update-alternatives -%endif -%if 0%{?suse_version} > 1020 BuildRequires: fdupes -%endif %if 0%{?suse_version} >= 1140 BuildRequires: wxWidgets @@ -70,6 +68,11 @@ BuildRequires: wxWidgets-wxcontainer-devel BuildRequires: wxGTK-devel >= 2.8 %endif +%if 0%{?suse_version} >=1230 +BuildRequires: pkgconfig(systemd) +%{?systemd_requires} +%endif + %define epmd_home %{_var}/lib/epmd %description @@ -383,11 +386,17 @@ find . -name "start_erl*" | xargs chmod 755 %endif install -d -m 0750 %{buildroot}%{epmd_home} +install -d -m 0755 %{buildroot}%{_sbindir} +%if 0%{?suse_version} >=1230 +install -D -m 0755 %{S:7} %{buildroot}%{_unitdir}/%{name}.service +install -D -m 0755 %{S:8} %{buildroot}%{_unitdir}/%{name}.socket +ln -s %{_unitdir}/%{name}.service %{buildroot}%{_sbindir}/rcepmd +%else install -D -m 0755 %{S:4} %{buildroot}/etc/init.d/epmd +ln -s /etc/init.d/epmd %{buildroot}%{_sbindir}/rcepmd +%endif install -D -m 0644 %{S:5} %{buildroot}/var/adm/fillup-templates/sysconfig.erlang install -D -m 0644 %{S:6} %{buildroot}%{_sysconfdir}/rpm/macros.erlang -install -d -m 0755 %{buildroot}%{_sbindir} -ln -s /etc/init.d/epmd %{buildroot}%{_sbindir}/rcepmd %pre /usr/sbin/groupadd -r epmd &>/dev/null || : @@ -398,11 +407,19 @@ ln -s /etc/init.d/epmd %{buildroot}%{_sbindir}/rcepmd %fillup_only erlang %preun +%if 0%{?suse_version} >=1230 +%service_del_preun %{name}.service %{name}.socket +%else %stop_on_removal epmd +%endif %postun +%if 0%{?suse_version} >=1230 +%service_del_postun %{name}.service %{name}.socket +%else %restart_on_update epmd %{insserv_cleanup} +%endif %files %defattr(-,root,root) @@ -472,7 +489,12 @@ ln -s /etc/init.d/epmd %{buildroot}%{_sbindir}/rcepmd %{_libdir}/erlang/Install %{_datadir}/emacs/site-lisp/erlang.el %dir %attr(-,epmd,epmd) %{epmd_home} +%if 0%{?suse_version} >=1230 +%{_unitdir}/%{name}.service +%{_unitdir}/%{name}.socket +%else /etc/init.d/epmd +%endif %{_sbindir}/rcepmd /var/adm/fillup-templates/sysconfig.erlang %config %{_sysconfdir}/rpm/macros.erlang