2015-05-09 12:55:05 +02:00
|
|
|
#
|
|
|
|
# spec file for package syncthing
|
|
|
|
#
|
2019-12-05 00:37:36 +01:00
|
|
|
# Copyright (c) 2019 SUSE LLC
|
2015-05-09 12:55:05 +02:00
|
|
|
#
|
|
|
|
# All modifications and additions to the file contributed by third parties
|
|
|
|
# remain the property of their copyright owners, unless otherwise agreed
|
|
|
|
# upon. The license for this file, and modifications and additions to the
|
|
|
|
# file, is the same license as for the pristine package itself (unless the
|
|
|
|
# license for the pristine package is not an Open Source License, in which
|
|
|
|
# case the license is the MIT License). An "Open Source License" is a
|
|
|
|
# license that conforms to the Open Source Definition (Version 1.9)
|
|
|
|
# published by the Open Source Initiative.
|
|
|
|
|
2019-07-26 13:36:11 +02:00
|
|
|
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
2015-05-09 12:55:05 +02:00
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
Name: syncthing
|
2019-12-05 00:37:36 +01:00
|
|
|
Version: 1.3.2
|
2015-05-09 12:55:05 +02:00
|
|
|
Release: 0
|
2018-04-17 17:40:15 +02:00
|
|
|
Summary: Continuous File Synchronisation
|
2015-05-12 15:14:00 +02:00
|
|
|
License: MPL-2.0
|
2015-05-09 12:55:05 +02:00
|
|
|
Group: Productivity/Networking/File-Sharing
|
2019-12-05 00:37:36 +01:00
|
|
|
URL: https://syncthing.net/
|
2015-12-21 01:39:49 +01:00
|
|
|
Source: https://github.com/%{name}/%{name}/releases/download/v%{version}/%{name}-source-v%{version}.tar.gz
|
2016-05-26 19:24:10 +02:00
|
|
|
Source1: https://github.com/%{name}/%{name}/releases/download/v%{version}/%{name}-source-v%{version}.tar.gz.asc
|
|
|
|
Source2: %{name}.keyring
|
2018-01-16 12:56:39 +01:00
|
|
|
BuildRequires: go >= 1.8
|
2015-05-09 12:55:05 +02:00
|
|
|
BuildRequires: systemd
|
|
|
|
BuildRequires: systemd-rpm-macros
|
2019-03-18 19:17:15 +01:00
|
|
|
%{?systemd_ordering}
|
2015-05-09 12:55:05 +02:00
|
|
|
|
|
|
|
%description
|
2018-03-19 23:40:23 +01:00
|
|
|
Syncthing is an application that synchronises files across multiple
|
2018-01-11 23:43:31 +01:00
|
|
|
devices. This means the creation, modification or deletion of files
|
|
|
|
on one machine will automatically be replicated to other devices.
|
2015-05-09 12:55:05 +02:00
|
|
|
|
2019-02-26 22:40:28 +01:00
|
|
|
%package relaysrv
|
|
|
|
Summary: Relay server for syncthing
|
|
|
|
Group: Productivity/Networking/File-Sharing
|
|
|
|
Requires(pre): pwdutils
|
2019-03-18 19:17:15 +01:00
|
|
|
%{?systemd_ordering}
|
2019-02-26 22:40:28 +01:00
|
|
|
|
|
|
|
%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.
|
|
|
|
|
2015-05-09 12:55:05 +02:00
|
|
|
%prep
|
2015-12-21 09:14:22 +01:00
|
|
|
%setup -q -n %{name}
|
2016-12-17 19:19:49 +01:00
|
|
|
|
2015-05-09 12:55:05 +02:00
|
|
|
%build
|
2018-11-17 16:17:51 +01:00
|
|
|
export BUILD_USER=abuild
|
2018-02-01 15:20:29 +01:00
|
|
|
export BUILD_HOST=openSUSE
|
2016-05-18 00:15:21 +02:00
|
|
|
mkdir -p build/src/ build/vendor/
|
|
|
|
export GOPATH="$PWD/build:$PWD/build/vendor"
|
|
|
|
|
2016-01-12 09:23:33 +01:00
|
|
|
mkdir -p build/src/github.com/%{name}/%{name}
|
|
|
|
ls | sed '/^build$/d' | xargs cp -at build/src/github.com/%{name}/%{name}
|
2016-05-18 00:15:21 +02:00
|
|
|
cp -a vendor build/vendor/src
|
|
|
|
|
|
|
|
pushd build/src/github.com/%{name}/%{name}/
|
2019-11-13 22:28:36 +01:00
|
|
|
go run build.go -version v%{version} install all
|
2016-05-18 00:15:21 +02:00
|
|
|
popd
|
2015-05-09 12:55:05 +02:00
|
|
|
|
|
|
|
%install
|
2016-09-11 03:20:53 +02:00
|
|
|
install -Dpm 0755 build/src/github.com/%{name}/%{name}/bin/%{name} \
|
2016-05-18 00:15:21 +02:00
|
|
|
%{buildroot}%{_bindir}/%{name}
|
2019-02-26 22:40:28 +01:00
|
|
|
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
|
2016-09-11 03:20:53 +02:00
|
|
|
install -Dpm 0644 etc/linux-systemd/system/%{name}@.service \
|
2015-05-09 12:55:05 +02:00
|
|
|
%{buildroot}%{_unitdir}/%{name}@.service
|
2016-09-11 03:20:53 +02:00
|
|
|
install -Dpm 0644 etc/linux-systemd/system/%{name}-resume.service \
|
2016-03-06 13:35:31 +01:00
|
|
|
%{buildroot}%{_unitdir}/%{name}-resume.service
|
2018-12-28 00:38:58 +01:00
|
|
|
%if 0%{?suse_version} >= 1500 || 0%{?sle_version} > 120300
|
2016-09-11 03:20:53 +02:00
|
|
|
install -Dpm 0644 etc/linux-systemd/user/%{name}.service \
|
2015-05-09 12:55:05 +02:00
|
|
|
%{buildroot}%{_userunitdir}/%{name}.service
|
2016-05-18 00:15:21 +02:00
|
|
|
%endif
|
2015-05-09 12:55:05 +02:00
|
|
|
|
|
|
|
%pre
|
2016-05-18 11:23:45 +02:00
|
|
|
%service_add_pre %{name}-resume.service
|
2015-05-09 12:55:05 +02:00
|
|
|
|
2019-02-26 22:40:28 +01:00
|
|
|
%pre relaysrv
|
|
|
|
%service_add_pre strelaysrv.service
|
2019-03-18 19:17:15 +01:00
|
|
|
getent group strelaysrv >/dev/null || /usr/sbin/groupadd -r strelaysrv
|
|
|
|
getent passwd strelaysrv >/dev/null || \
|
|
|
|
/usr/sbin/useradd -g strelaysrv -s /bin/false -r \
|
|
|
|
-c "User for syncthing relay server" -d /var/lib/strelaysrv strelaysrv
|
2019-02-26 22:40:28 +01:00
|
|
|
|
2015-05-09 12:55:05 +02:00
|
|
|
%post
|
2016-05-18 11:23:45 +02:00
|
|
|
%service_add_post %{name}-resume.service
|
2019-02-03 19:22:34 +01:00
|
|
|
%if 0%{?suse_version} >= 1500 || 0%{?sle_version} > 120300
|
2015-05-09 12:55:05 +02:00
|
|
|
%systemd_user_post %{name}.service
|
2019-02-03 19:22:34 +01:00
|
|
|
%endif
|
2015-05-09 12:55:05 +02:00
|
|
|
|
2019-02-26 22:40:28 +01:00
|
|
|
%post relaysrv
|
|
|
|
%service_add_post strelaysrv.service
|
|
|
|
|
2015-05-09 12:55:05 +02:00
|
|
|
%preun
|
2016-03-06 13:35:31 +01:00
|
|
|
%service_del_preun %{name}@.service %{name}-resume.service
|
2019-02-03 19:22:34 +01:00
|
|
|
%if 0%{?suse_version} >= 1500 || 0%{?sle_version} > 120300
|
2015-05-09 12:55:05 +02:00
|
|
|
%systemd_user_preun %{name}.service
|
2019-02-03 19:22:34 +01:00
|
|
|
%endif
|
2015-05-09 12:55:05 +02:00
|
|
|
|
2019-02-26 22:40:28 +01:00
|
|
|
%preun relaysrv
|
|
|
|
%service_del_preun strelaysrv.service
|
|
|
|
|
2015-05-09 12:55:05 +02:00
|
|
|
%postun
|
2016-05-18 11:23:45 +02:00
|
|
|
%service_del_postun %{name}-resume.service
|
2019-02-03 19:22:34 +01:00
|
|
|
%if 0%{?suse_version} >= 1500 || 0%{?sle_version} > 120300
|
2015-05-09 12:55:05 +02:00
|
|
|
%systemd_user_postun %{name}.service
|
2019-02-03 19:22:34 +01:00
|
|
|
%endif
|
2015-05-09 12:55:05 +02:00
|
|
|
|
2019-02-26 22:40:28 +01:00
|
|
|
%postun relaysrv
|
|
|
|
%service_del_postun strelaysrv.service
|
|
|
|
|
2015-05-09 12:55:05 +02:00
|
|
|
%files
|
2018-03-19 23:40:23 +01:00
|
|
|
%license LICENSE
|
|
|
|
%doc AUTHORS CONDUCT.md CONTRIBUTING.md README.md
|
2015-05-09 12:55:05 +02:00
|
|
|
%{_bindir}/%{name}
|
2019-02-26 22:40:28 +01:00
|
|
|
%{_bindir}/stcli
|
2015-05-09 12:55:05 +02:00
|
|
|
%{_unitdir}/%{name}@.service
|
2016-03-06 13:35:31 +01:00
|
|
|
%{_unitdir}/%{name}-resume.service
|
2019-02-03 19:22:34 +01:00
|
|
|
%if 0%{?suse_version} >= 1500 || 0%{?sle_version} > 120300
|
2015-05-09 12:55:05 +02:00
|
|
|
%{_userunitdir}/%{name}.service
|
2019-02-03 19:22:34 +01:00
|
|
|
%endif
|
2015-05-09 12:55:05 +02:00
|
|
|
|
2019-02-26 22:40:28 +01:00
|
|
|
%files relaysrv
|
|
|
|
%{_bindir}/strelaysrv
|
|
|
|
%{_unitdir}/strelaysrv.service
|
|
|
|
%dir %attr(750,strelaysrv,strelaysrv) %{_localstatedir}/lib/strelaysrv
|
|
|
|
|
2015-05-09 12:55:05 +02:00
|
|
|
%changelog
|