From 5c69908f7077b16c1542b6de1501d487f5a1b78b515c9304ad0a0801f4b0b50e Mon Sep 17 00:00:00 2001 From: Alexei Sorokin Date: Tue, 26 Feb 2019 21:40:28 +0000 Subject: [PATCH] Accepting request 679442 from home:bhwachter - Package additional binaries * Add CLI (stcli) to main package * Add relay server (strelaysrv) to relaysrv subpackage OBS-URL: https://build.opensuse.org/request/show/679442 OBS-URL: https://build.opensuse.org/package/show/network/syncthing?expand=0&rev=158 --- syncthing.changes | 7 +++++++ syncthing.spec | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/syncthing.changes b/syncthing.changes index 5bde384..9954f87 100644 --- a/syncthing.changes +++ b/syncthing.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Tue Feb 26 11:11:02 UTC 2019 - Bernd Wachter + +- Package additional binaries + * Add CLI (stcli) to main package + * Add relay server (strelaysrv) to relaysrv subpackage + ------------------------------------------------------------------- Tue Feb 19 10:45:23 UTC 2019 - Marius Kittler diff --git a/syncthing.spec b/syncthing.spec index 8f3992c..a806896 100644 --- a/syncthing.spec +++ b/syncthing.spec @@ -36,6 +36,16 @@ Syncthing is an application that synchronises files across multiple devices. This means the creation, modification or deletion of files on one machine will automatically be replicated to other devices. +%package relaysrv +Summary: Relay server for syncthing +Group: Productivity/Networking/File-Sharing +Requires(pre): pwdutils + +%description relaysrv +Syncthing requires relay servers for NAT traversal. This package +contains the necessary files for setting up a relay server, either +joined to the syncthing relay pool or private. + %prep %setup -q -n %{name} @@ -58,6 +68,17 @@ popd %install install -Dpm 0755 build/src/github.com/%{name}/%{name}/bin/%{name} \ %{buildroot}%{_bindir}/%{name} +install -Dpm 0755 build/src/github.com/%{name}/%{name}/bin/stcli \ + %{buildroot}%{_bindir}/stcli +install -Dpm 0755 build/src/github.com/%{name}/%{name}/bin/strelaysrv \ + %{buildroot}%{_bindir}/strelaysrv +install -dm 0750 %{buildroot}/%{_localstatedir}/lib/strelaysrv +install -Dpm 0644 cmd/strelaysrv/etc/linux-systemd/strelaysrv.service \ + %{buildroot}%{_unitdir}/strelaysrv.service +sed -i '/Service\]/a EnvironmentFile=-\/etc\/default/strelaysrv' \ + %{buildroot}%{_unitdir}/strelaysrv.service +sed -i 's,^ExecStart=.*,ExecStart=/usr/bin/strelaysrv $OPTIONS,' \ + %{buildroot}%{_unitdir}/strelaysrv.service install -Dpm 0644 etc/linux-systemd/system/%{name}@.service \ %{buildroot}%{_unitdir}/%{name}@.service install -Dpm 0644 etc/linux-systemd/system/%{name}-resume.service \ @@ -72,33 +93,53 @@ install -Dpm 0644 %{name}.firewall \ %pre %service_add_pre %{name}-resume.service +%pre relaysrv +%service_add_pre strelaysrv.service +/usr/sbin/groupadd -r strelaysrv &>/dev/null ||: +/usr/sbin/useradd -g strelaysrv -s /bin/false -r -c "User for syncthing relay server" -d /var/lib/strelaysrv strelaysrv &>/dev/null ||: + %post %service_add_post %{name}-resume.service %if 0%{?suse_version} >= 1500 || 0%{?sle_version} > 120300 %systemd_user_post %{name}.service %endif +%post relaysrv +%service_add_post strelaysrv.service + %preun %service_del_preun %{name}@.service %{name}-resume.service %if 0%{?suse_version} >= 1500 || 0%{?sle_version} > 120300 %systemd_user_preun %{name}.service %endif +%preun relaysrv +%service_del_preun strelaysrv.service + %postun %service_del_postun %{name}-resume.service %if 0%{?suse_version} >= 1500 || 0%{?sle_version} > 120300 %systemd_user_postun %{name}.service %endif +%postun relaysrv +%service_del_postun strelaysrv.service + %files %license LICENSE %doc AUTHORS CONDUCT.md CONTRIBUTING.md README.md %config %{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/%{name} %{_bindir}/%{name} +%{_bindir}/stcli %{_unitdir}/%{name}@.service %{_unitdir}/%{name}-resume.service %if 0%{?suse_version} >= 1500 || 0%{?sle_version} > 120300 %{_userunitdir}/%{name}.service %endif +%files relaysrv +%{_bindir}/strelaysrv +%{_unitdir}/strelaysrv.service +%dir %attr(750,strelaysrv,strelaysrv) %{_localstatedir}/lib/strelaysrv + %changelog