2015-05-09 12:55:05 +02:00
|
|
|
#
|
|
|
|
# spec file for package syncthing
|
|
|
|
#
|
2022-01-14 10:54:30 +01:00
|
|
|
# Copyright (c) 2022 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
|
2022-12-06 11:34:37 +01:00
|
|
|
Version: 1.22.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
|
2021-12-07 13:48:41 +01:00
|
|
|
Patch0: harden_strelaysrv.service.patch
|
|
|
|
Patch1: harden_syncthing-resume.service.patch
|
|
|
|
Patch2: harden_syncthing@.service.patch
|
2015-05-09 12:55:05 +02:00
|
|
|
BuildRequires: systemd-rpm-macros
|
2020-08-26 18:29:47 +02:00
|
|
|
BuildRequires: golang(API) >= 1.14
|
2020-02-03 19:21:58 +01:00
|
|
|
BuildRequires: pkgconfig(systemd)
|
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}
|
2021-11-24 16:24:44 +01:00
|
|
|
%patch0 -p1
|
|
|
|
%patch1 -p1
|
|
|
|
%patch2 -p1
|
2016-12-17 19:19:49 +01:00
|
|
|
|
2015-05-09 12:55:05 +02:00
|
|
|
%build
|
2020-08-18 17:47:35 +02:00
|
|
|
# move source archive which is extracted as "syncthing" to be "src/github.com/syncthing/syncthing"
|
|
|
|
cd ..
|
|
|
|
install -d "src/github.com/syncthing/"
|
|
|
|
mv %{name} "src/github.com/syncthing/"%{name}
|
|
|
|
mkdir syncthing
|
|
|
|
cd "$PWD/src/github.com/syncthing/"%{name}
|
2016-05-18 00:15:21 +02:00
|
|
|
|
2020-08-18 17:47:35 +02:00
|
|
|
# set build environment, in particular use "-mod=vendor" to use the Go modules from the source archive's vendor dir
|
|
|
|
export BUILD_USER=abuild BUILD_HOST=openSUSE
|
|
|
|
export CGO_CPPFLAGS="${CPPFLAGS}" CGO_CFLAGS="${CFLAGS}" CGO_CXXFLAGS="${CXXFLAGS}" CGO_LDFLAGS="${LDFLAGS}"
|
|
|
|
export GOFLAGS="-trimpath -mod=vendor"
|
2016-05-18 00:15:21 +02:00
|
|
|
|
2020-02-07 20:32:51 +01:00
|
|
|
# build and install syncthing without automatic updates
|
|
|
|
go run build.go -no-upgrade -version v%{version} install
|
|
|
|
# build and install strelaysrv without automatic updates
|
|
|
|
go run build.go -no-upgrade -version v%{version} install strelaysrv
|
2015-05-09 12:55:05 +02:00
|
|
|
|
|
|
|
%install
|
2020-08-18 17:47:35 +02:00
|
|
|
st_dir=$PWD
|
|
|
|
cd ../src/github.com/syncthing/%{name}
|
|
|
|
mv LICENSE AUTHORS CONDUCT.md CONTRIBUTING.md README.md "$st_dir"
|
|
|
|
install -Dpm 0755 bin/%{name} %{buildroot}%{_bindir}/%{name}
|
|
|
|
install -Dpm 0755 bin/strelaysrv %{buildroot}%{_bindir}/strelaysrv
|
2021-09-26 11:35:10 +02:00
|
|
|
install -dm 0750 %{buildroot}/%{_localstatedir}/lib/syncthing-relaysrv
|
2019-02-26 22:40:28 +01:00
|
|
|
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
|
2021-05-29 17:57:46 +02:00
|
|
|
sed -i 's,EnvironmentFile=/etc/default/syncthing-relaysrv,EnvironmentFile=-/etc/default/syncthing-relaysrv,' \
|
|
|
|
%{buildroot}%{_unitdir}/strelaysrv.service
|
|
|
|
sed -i 's/^User=.*/User=strelaysrv/' \
|
|
|
|
%{buildroot}%{_unitdir}/strelaysrv.service
|
|
|
|
sed -i 's/^Group=.*/Group=strelaysrv/' \
|
|
|
|
%{buildroot}%{_unitdir}/strelaysrv.service
|
2021-09-26 11:35:10 +02:00
|
|
|
sed -i 's,^ReadWritePaths=.*,ReadWritePaths=/var/lib/syncthing-relaysrv,' \
|
2021-05-29 17:57:46 +02:00
|
|
|
%{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
|
2022-01-15 00:19:07 +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}
|
|
|
|
%{_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
|
2021-05-14 10:12:06 +02:00
|
|
|
%license LICENSE
|
2019-02-26 22:40:28 +01:00
|
|
|
%{_bindir}/strelaysrv
|
|
|
|
%{_unitdir}/strelaysrv.service
|
2021-09-26 11:35:10 +02:00
|
|
|
%dir %attr(750,strelaysrv,strelaysrv) %{_localstatedir}/lib/syncthing-relaysrv
|
2019-02-26 22:40:28 +01:00
|
|
|
|
2015-05-09 12:55:05 +02:00
|
|
|
%changelog
|