Make syncthing-relaysrv package resolvable
OBS-URL: https://build.opensuse.org/package/show/network/syncthing?expand=0&rev=291
This commit is contained in:
parent
affdc8ef4d
commit
82f229b7c1
3
syncthing-relaysrv-user.conf
Normal file
3
syncthing-relaysrv-user.conf
Normal file
@ -0,0 +1,3 @@
|
||||
# Type Name ID GECOS Home directory Shell
|
||||
u strelaysrv - "Syncthing Relay Server" /var/lib/syncthing-relaysrv -
|
||||
m strelaysrv -
|
@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Mon Feb 5 10:42:05 UTC 2024 - Marius Kittler <marius.kittler@suse.com>
|
||||
|
||||
- Make syncthing-relaysrv package resolvable by using systemd users
|
||||
to create the required user and group
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Jan 9 08:02:25 UTC 2024 - Kyle Scheuing <kyle@kylescheuing.com>
|
||||
|
||||
|
@ -26,10 +26,12 @@ URL: https://syncthing.net/
|
||||
Source: https://github.com/%{name}/%{name}/releases/download/v%{version}/%{name}-source-v%{version}.tar.gz
|
||||
Source1: https://github.com/%{name}/%{name}/releases/download/v%{version}/%{name}-source-v%{version}.tar.gz.asc
|
||||
Source2: %{name}.keyring
|
||||
Source3: %{name}-relaysrv-user.conf
|
||||
Patch0: harden_strelaysrv.service.patch
|
||||
Patch1: harden_syncthing-resume.service.patch
|
||||
Patch2: harden_syncthing@.service.patch
|
||||
BuildRequires: systemd-rpm-macros
|
||||
BuildRequires: sysuser-tools
|
||||
BuildRequires: update-desktop-files
|
||||
BuildRequires: golang(API) >= 1.14
|
||||
BuildRequires: pkgconfig(systemd)
|
||||
@ -45,6 +47,7 @@ Summary: Relay server for syncthing
|
||||
Group: Productivity/Networking/File-Sharing
|
||||
Requires(pre): pwdutils
|
||||
%{?systemd_ordering}
|
||||
%sysusers_requires
|
||||
|
||||
%description relaysrv
|
||||
Syncthing requires relay servers for NAT traversal. This package
|
||||
@ -75,6 +78,8 @@ 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
|
||||
|
||||
%sysusers_generate_pre %{name}-strelaysrv-user.conf %{name}-strelaysrv %{name}-strelaysrv-user.conf
|
||||
|
||||
%install
|
||||
st_dir=$PWD
|
||||
cd ../src/github.com/syncthing/%{name}
|
||||
@ -104,6 +109,7 @@ install -Dpm 0644 etc/linux-systemd/system/%{name}-resume.service \
|
||||
install -Dpm 0644 etc/linux-systemd/user/%{name}.service \
|
||||
%{buildroot}%{_userunitdir}/%{name}.service
|
||||
%endif
|
||||
install -D -m 0644 %{SOURCE3} %{buildroot}%{_sysusersdir}/%{name}-relaysrv.conf
|
||||
|
||||
%suse_update_desktop_file -i "syncthing-ui"
|
||||
|
||||
@ -112,10 +118,6 @@ install -Dpm 0644 etc/linux-systemd/user/%{name}.service \
|
||||
|
||||
%pre relaysrv
|
||||
%service_add_pre strelaysrv.service
|
||||
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
|
||||
|
||||
%post
|
||||
%service_add_post %{name}-resume.service
|
||||
@ -160,5 +162,6 @@ getent passwd strelaysrv >/dev/null || \
|
||||
%{_bindir}/strelaysrv
|
||||
%{_unitdir}/strelaysrv.service
|
||||
%dir %attr(750,strelaysrv,strelaysrv) %{_localstatedir}/lib/syncthing-relaysrv
|
||||
%{_sysusersdir}/%{name}-relaysrv.conf
|
||||
|
||||
%changelog
|
||||
|
Loading…
Reference in New Issue
Block a user