From 42bccfda0b848402487587f587fda55a338bc1d8b31350ee5eb57ce0be14e204 Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Mon, 2 Jan 2023 08:58:47 +0000 Subject: [PATCH] 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 --- tgt-include-sys-macros-for-major.patch | 11 ----- ...nstall-examples-in-documentation-dir.patch | 27 ++--------- tgt-systemd-service-update.patch | 48 +++++++++++++++++++ tgt.changes | 14 ++++++ tgt.spec | 23 +++++---- tgtd.service | 25 ---------- 6 files changed, 79 insertions(+), 69 deletions(-) delete mode 100644 tgt-include-sys-macros-for-major.patch rename setup-tgt-conf-d.patch => tgt-install-examples-in-documentation-dir.patch (61%) create mode 100644 tgt-systemd-service-update.patch delete mode 100644 tgtd.service diff --git a/tgt-include-sys-macros-for-major.patch b/tgt-include-sys-macros-for-major.patch deleted file mode 100644 index c1d44da..0000000 --- a/tgt-include-sys-macros-for-major.patch +++ /dev/null @@ -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 - #include - #include -+#include - - #include "bsg.h" /* Copied from include/linux/bsg.h */ - #include "list.h" diff --git a/setup-tgt-conf-d.patch b/tgt-install-examples-in-documentation-dir.patch similarity index 61% rename from setup-tgt-conf-d.patch rename to tgt-install-examples-in-documentation-dir.patch index 265ed67..94fd045 100644 --- a/setup-tgt-conf-d.patch +++ b/tgt-install-examples-in-documentation-dir.patch @@ -1,7 +1,7 @@ From 4711fc19b6b83d572fd6eafd64a834559cae8ce2 Mon Sep 17 00:00:00 2001 From: Hannes Reinecke 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 Acked-by: Hannes Reinecke --- - 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 - diff --git a/tgt-systemd-service-update.patch b/tgt-systemd-service-update.patch new file mode 100644 index 0000000..80eac68 --- /dev/null +++ b/tgt-systemd-service-update.patch @@ -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 diff --git a/tgt.changes b/tgt.changes index efa8319..60d2403 100644 --- a/tgt.changes +++ b/tgt.changes @@ -1,3 +1,17 @@ +------------------------------------------------------------------- +Fri Dec 23 20:01:34 UTC 2022 - Lee Duncan + +- 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 diff --git a/tgt.spec b/tgt.spec index 96ca0a4..609cd1d 100644 --- a/tgt.spec +++ b/tgt.spec @@ -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 diff --git a/tgtd.service b/tgtd.service deleted file mode 100644 index 0b1c4b8..0000000 --- a/tgtd.service +++ /dev/null @@ -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