Refactor motd patch for crontabs

According to analysis from Saul in task 26455, we can remove motd
patch for crontabs and then use RPM instead of SRPM for it.
We also need to remove usage of --without-progname in utilities/
update-motd/files/motd-update.

Story: 2003765
Task: 28181 & 28182
Depends-on: https://review.openstack.org/#/c/623385/

Change-Id: I4be7d47ee77ac07eb24f5b88cd707c29b595df7a
Signed-off-by: zhipengl <zhipengs.liu@intel.com>
This commit is contained in:
zhipengl 2018-12-07 19:32:34 +08:00 committed by zhipeng liu
parent 0dd574e635
commit c658f53d02
8 changed files with 1 additions and 131 deletions

View File

@ -1 +0,0 @@
TIS_PATCH_VER=2

View File

@ -1,25 +0,0 @@
From a15d83975ed19367767e18354ea07cd5d281e265 Mon Sep 17 00:00:00 2001
From: Don Penney <don.penney@windriver.com>
Date: Tue, 27 Sep 2016 10:14:02 -0400
Subject: [PATCH] Update package versioning for TIS format
---
SPECS/crontabs.spec | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/SPECS/crontabs.spec b/SPECS/crontabs.spec
index 7001d1a..4512bcc 100644
--- a/SPECS/crontabs.spec
+++ b/SPECS/crontabs.spec
@@ -2,7 +2,7 @@
Summary: Root crontab files used to schedule the execution of programs
Name: crontabs
Version: 1.11
-Release: 6.%{snap_release}%{?dist}
+Release: 6.%{snap_release}.el7%{?_tis_dist}.%{tis_patch_ver}
License: Public Domain and GPLv2
Group: System Environment/Base
URL: https://fedorahosted.org/crontabs
--
1.8.3.1

View File

@ -1,2 +0,0 @@
spec-add-patch-to-remove-printing-of-motd-script-nam.patch
0001-Update-package-versioning-for-TIS-format.patch

View File

@ -1,35 +0,0 @@
From 9221bd11aec1590df2dc3f19e9a582d76ed7adc0 Mon Sep 17 00:00:00 2001
From: Michel Thebeau <michel.thebeau@windriver.com>
Date: Mon, 25 Jul 2016 11:45:55 -0400
Subject: [PATCH] spec: add patch to remove printing of motd script name
Signed-off-by: Michel Thebeau <michel.thebeau@windriver.com>
---
SPECS/crontabs.spec | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/SPECS/crontabs.spec b/SPECS/crontabs.spec
index d6a8c69..90098e1 100644
--- a/SPECS/crontabs.spec
+++ b/SPECS/crontabs.spec
@@ -10,6 +10,8 @@ Source0: https://fedorahosted.org/releases/c/r/crontabs/%{name}-%{version}-1.%{s
BuildArch: noarch
Requires: /etc/cron.d
+Patch1: run-parts-add-option-to-remove-printing-of-motd-scri.patch
+
%description
This package is used by Fedora mainly for executing files by cron.
@@ -25,6 +27,8 @@ your system.
%prep
%setup -q
+%patch1 -p1
+
%build
#empty
--
1.8.3.1

View File

@ -1,65 +0,0 @@
From f0bd54cb83ba430ef81153c7a6da2a52daca5266 Mon Sep 17 00:00:00 2001
From: Michel Thebeau <michel.thebeau@windriver.com>
Date: Mon, 25 Jul 2016 11:23:18 -0400
Subject: [PATCH] run-parts: add option to remove printing of motd script name
The awk statement seems to be a round-about way of printing the name of
the motd script (/etc/motd.d/*). The pipe seems to allow awk to print
without user input; while the end of input causes awk to exit. Any
input to awk is echoed to terminal before the motd script name is
printed.
The script name that is printed is appended to /etc/motd. This is
undesirable. Add an option to skip the awk program.
Signed-off-by: Michel Thebeau <michel.thebeau@windriver.com>
---
run-parts | 25 +++++++++++++++++++------
1 file changed, 19 insertions(+), 6 deletions(-)
diff --git a/run-parts b/run-parts
index 7e148f8..b444f4e 100755
--- a/run-parts
+++ b/run-parts
@@ -4,6 +4,14 @@
# keep going when something fails
set +e
+# First parameter to remove printing of the names of executed scripts.
+# The default is unmodified behaviour, print the name of scripts.
+with_progname="y"
+if [ "$1" == "--without-progname" ]; then
+ with_progname=""
+ shift
+fi
+
if [ $# -lt 1 ]; then
echo "Usage: run-parts [--list | --test] <dir>"
exit 1
@@ -87,12 +95,17 @@ for i in $(LC_ALL=C; echo ${1%/}/*[^~,]) ; do
# run executable files
logger -p cron.notice -t "run-parts($1)[$$]" "starting $(basename $i)"
- $i 2>&1 | awk -v "progname=$i" \
- 'progname {
- print progname ":\n"
- progname="";
- }
- { print; }'
+ if [ -n "$with_progname" ]; then
+ $i 2>&1 | awk -v "progname=$i" \
+ 'progname {
+ print progname ":\n"
+ progname="";
+ }
+ { print; }'
+ else
+ $i 2>&1
+ fi
+
logger -i -p cron.notice -t "run-parts($1)" "finished $(basename $i)"
fi
fi
--
1.8.3.1

View File

@ -1 +0,0 @@
mirror:Source/crontabs-1.11-6.20121102git.el7.src.rpm

View File

@ -142,7 +142,6 @@ networking/net-tools
filesystem/drbd/drbd-tools
database/mariadb
database/python-psycopg2
base/crontabs
base/dnsmasq
base/dnsmasq-config
filesystem/parted

View File

@ -11,5 +11,5 @@ MOTD_PATH=${MOTD_PATH:-"/etc/motd.d"}
MOTD_TAG=${MOTD_TAG:-"motd-update"}
if [ -d ${MOTD_PATH} ]; then
run-parts --without-progname ${MOTD_PATH} 1>${MOTD_FILE}
run-parts ${MOTD_PATH} 1>${MOTD_FILE}
fi