Accepting request 1045840 from home:lee_duncan:branches:Base:System

- Some cleanup (bsc#1206639):
  * removed patch setup-tgt-conf-d.patch, since it's upstream,
    and having it caused duplicated include of user config
  * renamed setup-tgt-conf-d.patch to
    tgt-install-examples-in-documentation-dir.patch, to better
    reflect what it does (since it no longer sets up tgt.conf.d)
  * removed the sytemd source file we have, since we get
    tgtd.service from upstream now (with a patch)
  * added patch tgt-systemd-service-update.patch, to ensure
    SUSE-specific changes are in the service file

OBS-URL: https://build.opensuse.org/request/show/1045840
OBS-URL: https://build.opensuse.org/package/show/Base:System/tgt?expand=0&rev=55
This commit is contained in:
Dirk Mueller 2023-01-02 08:58:47 +00:00 committed by Git OBS Bridge
parent 893a0ff634
commit 42bccfda0b
6 changed files with 79 additions and 69 deletions

View File

@ -1,11 +0,0 @@
diff -aurp tgt-1.0.60.orig/usr/bs_sg.c tgt-1.0.60/usr/bs_sg.c
--- tgt-1.0.60.orig/usr/bs_sg.c 2015-07-01 17:10:39.000000000 -0700
+++ tgt-1.0.60/usr/bs_sg.c 2018-08-11 18:03:25.489712435 -0700
@@ -38,6 +38,7 @@
#include <sys/epoll.h>
#include <sys/sysmacros.h>
#include <scsi/sg.h>
+#include <sys/sysmacros.h>
#include "bsg.h" /* Copied from include/linux/bsg.h */
#include "list.h"

View File

@ -1,7 +1,7 @@
From 4711fc19b6b83d572fd6eafd64a834559cae8ce2 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Wed, 26 Feb 2014 12:50:09 +0100
Subject: [PATCH 2/2] Install examples in documentation directory
Subject: Install examples in documentation directory
The examples should be installed in the documentation directory,
not the standard configuration directory.
@ -9,12 +9,9 @@ not the standard configuration directory.
Signed-off-by: Dirk Mueller <dmueller@suse.com>
Acked-by: Hannes Reinecke <hare@suse.de>
---
conf/Makefile | 6 ++++--
conf/targets.conf | 5 +++++
2 files changed, 9 insertions(+), 2 deletions(-)
conf/Makefile | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/conf/Makefile b/conf/Makefile
index bff222f..abb763e 100644
--- a/conf/Makefile
+++ b/conf/Makefile
@@ -1,4 +1,5 @@
@ -36,21 +33,3 @@ index bff222f..abb763e 100644
done
install -d $(DESTDIR)$(sysconfdir)/tgt/conf.d
diff --git a/conf/targets.conf b/conf/targets.conf
index 1bb4435..70b608a 100644
--- a/conf/targets.conf
+++ b/conf/targets.conf
@@ -1,5 +1,10 @@
# Empty targets configuration file -- please see the package
# documentation directory for an example.
+
+#
+# Include configuration from directory
+#
+include /etc/tgt/conf.d/*.conf
#
# You can drop individual config snippets into /etc/tgt/conf.d
include /etc/tgt/conf.d/*.conf
--
1.8.1.4

View File

@ -0,0 +1,48 @@
From: Lee Duncan
Date: Sat 24 Dec 2022 09:15:40 AM PST
Subject: [PATCH] tgt: systemd service update
Update our systemd service file to match what we do at SUSE.
---
--- a/scripts/tgtd.service
+++ b/scripts/tgtd.service
@@ -1,11 +1,7 @@
[Unit]
Description=iSCSI target framework daemon
-Documentation=man: tgtd(8)
+Documentation=man:tgtd(8)
After=network.target
-
-# On systems without virtual consoles, don't start any getty. Note
-# that serial gettys are covered by serial-getty@.service, not this
-# unit.
ConditionPathExists=/etc/tgt/targets.conf
[Service]
@@ -18,10 +14,14 @@ ProtectKernelTunables=true
ProtectKernelLogs=true
RestrictRealtime=true
# end of automatic additions
-Type=forking
+
Environment=TGTD_CONFIG=/etc/tgt/targets.conf
+EnvironmentFile=-/etc/sysconfig/tgt
+
+Type=forking
+
+ExecStart=/usr/sbin/tgtd $TGTD_OPTS
-ExecStart=/usr/sbin/tgtd
ExecStartPost=/usr/sbin/tgtadm --op update --mode sys --name State -v offline
ExecStartPost=/usr/sbin/tgtadm --op update --mode sys --name State -v ready
ExecStartPost=/usr/sbin/tgt-admin -e -c ${TGTD_CONFIG}
@@ -33,8 +33,6 @@ ExecStop=/usr/sbin/tgt-admin --offline A
ExecStop=/usr/sbin/tgt-admin --update ALL -c /dev/null -f
ExecStop=/usr/sbin/tgtadm --op delete --mode system
-# Exit code: 107 tgtd not running
-
[Install]
WantedBy=multi-user.target

View File

@ -1,3 +1,17 @@
-------------------------------------------------------------------
Fri Dec 23 20:01:34 UTC 2022 - Lee Duncan <lduncan@suse.com>
- Some cleanup (bsc#1206639):
* removed patch setup-tgt-conf-d.patch, since it's upstream,
and having it caused duplicated include of user config
* renamed setup-tgt-conf-d.patch to
tgt-install-examples-in-documentation-dir.patch, to better
reflect what it does (since it no longer sets up tgt.conf.d)
* removed the sytemd source file we have, since we get
tgtd.service from upstream now (with a patch)
* added patch tgt-systemd-service-update.patch, to ensure
SUSE-specific changes are in the service file
-------------------------------------------------------------------
Sat Dec 3 17:25:58 UTC 2022 - Dirk Müller <dmueller@suse.com>

View File

@ -20,6 +20,10 @@
%if ! %{defined _fillupdir}
%define _fillupdir %{_localstatedir}/adm/fillup-templates
%endif
#Compat macro for make_build macro (needed in SLE12-SP5)
%if ! %{defined make_build}
%define make_build %{__make} %{?_smp_mflags}
%endif
Name: tgt
Version: 1.0.84
Release: 0
@ -28,21 +32,22 @@ License: GPL-2.0-only
Group: System/Daemons
URL: https://github.com/fujita/tgt
Source: https://github.com/fujita/tgt/archive/refs/tags/v%{version}.tar.gz
Source1: %{name}d.service
Source4: sysconfig.%{name}
Source1: sysconfig.%{name}
Patch1: %{name}-fix-build
Patch2: setup-tgt-conf-d.patch
Patch3: %{name}-include-sys-macros-for-major.patch
Patch5: harden_tgtd.service.patch
Patch2: %{name}-install-examples-in-documentation-dir.patch
Patch3: harden_tgtd.service.patch
Patch4: %{name}-systemd-service-update.patch
BuildRequires: docbook-xsl-stylesheets
BuildRequires: libaio-devel
BuildRequires: libxslt
BuildRequires: libxslt-tools
BuildRequires: libxslt1
BuildRequires: openssl-devel
BuildRequires: perl-Config-General
BuildRequires: systemd-rpm-macros
Requires: perl-Config-General
Requires(pre): %fillup_prereq
Obsoletes: iscsitarget
%{?systemd_requires}
%description
Linux target framework (tgt) aims to simplify various SCSI target
@ -57,7 +62,7 @@ user-space daemon and tools (i.e. they completely runs in user space).
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch5 -p1
%patch4 -p1
%build
%ifarch ppc ppc64 ppc64le
@ -69,8 +74,8 @@ user-space daemon and tools (i.e. they completely runs in user space).
%install
make DESTDIR=%{buildroot} docdir=%{_docdir}/%{name} install
install -vD -m 644 %{SOURCE1} %{buildroot}/%{_unitdir}/%{name}d.service
install -vD %{SOURCE4} %{buildroot}%{_fillupdir}/sysconfig.%{name}
install -vDm644 scripts/tgtd.service %{buildroot}%{_unitdir}/tgtd.service
install -vD %{S:1} %{buildroot}%{_fillupdir}/sysconfig.%{name}
ln -sf service %{buildroot}/%{_sbindir}/rc%{name}d
%pre

View File

@ -1,25 +0,0 @@
[Unit]
Description=tgt admin
After=network.target
[Service]
# added automatically, for details please see
# https://en.opensuse.org/openSUSE:Security_Features#Systemd_hardening_effort
ProtectSystem=full
ProtectHome=true
ProtectHostname=true
ProtectKernelTunables=true
ProtectKernelLogs=true
RestrictRealtime=true
# end of automatic additions
EnvironmentFile=-/etc/sysconfig/tgt
Type=forking
User=root
ExecStart=/usr/sbin/tgtd $TGTD_OPTS
ExecStartPost=/bin/bash -c "sleep 0.5 ; /usr/sbin/tgtadm --op update --mode sys --name State -v offline ; /usr/sbin/tgt-admin -e -c /etc/tgt/targets.conf ; /usr/sbin/tgtadm --op update --mode sys --name State -v ready"
# only valid in .socket: ExecStopPre=/usr/sbin/tgt-admin --update ALL -c /dev/null
ExecStop=-/usr/sbin/tgtadm --op delete --mode system
[Install]
WantedBy=multi-user.target