diff --git a/centos_pkg_dirs b/centos_pkg_dirs index 3b90b8b6..ec3f451b 100644 --- a/centos_pkg_dirs +++ b/centos_pkg_dirs @@ -9,4 +9,5 @@ patch-scripts/EXAMPLE_VIM patch-scripts/EXAMPLE_SYSINV patch-scripts/EXAMPLE_SERVICE patch-scripts/EXAMPLE_KUBELET +patch-scripts/EXAMPLE_DOCKER enable-dev-patch diff --git a/patch-scripts/EXAMPLE_DOCKER/centos/EXAMPLE_DOCKER.spec b/patch-scripts/EXAMPLE_DOCKER/centos/EXAMPLE_DOCKER.spec new file mode 100644 index 00000000..a74c7430 --- /dev/null +++ b/patch-scripts/EXAMPLE_DOCKER/centos/EXAMPLE_DOCKER.spec @@ -0,0 +1,27 @@ +Name: EXAMPLE_DOCKER +Summary: StarlingX In-Service dockerd Patch Script Example +Version: 1.0 +Release: %{tis_patch_ver}%{?_tis_dist} +License: windriver +Group: base +Packager: Wind River +Source0: dockerd-process-restart + +%install + install -Dp -m 700 %{S:0} %{buildroot}%{_patch_scripts}/%{name} + +%description +%{summary} + +%files +%defattr(-,root,root,-) +%{_patch_scripts}/* + +%post +cp -f %{_patch_scripts}/%{name} %{_runtime_patch_scripts}/ +exit 0 + +%preun +cp -f %{_patch_scripts}/%{name} %{_runtime_patch_scripts}/ +exit 0 + diff --git a/patch-scripts/EXAMPLE_DOCKER/centos/build_srpm.data b/patch-scripts/EXAMPLE_DOCKER/centos/build_srpm.data new file mode 100644 index 00000000..4e4d73ac --- /dev/null +++ b/patch-scripts/EXAMPLE_DOCKER/centos/build_srpm.data @@ -0,0 +1,2 @@ +COPY_LIST="scripts/*" +TIS_PATCH_VER=PKG_GITREVCOUNT diff --git a/patch-scripts/EXAMPLE_DOCKER/scripts/dockerd-process-restart b/patch-scripts/EXAMPLE_DOCKER/scripts/dockerd-process-restart new file mode 100644 index 00000000..adc5b368 --- /dev/null +++ b/patch-scripts/EXAMPLE_DOCKER/scripts/dockerd-process-restart @@ -0,0 +1,42 @@ +#!/bin/bash +# +# Copyright (c) 2022 Wind River Systems, Inc. +# +# SPDX-License-Identifier: Apache-2.0 +# + +# +# This script provides an in-service patching restart script for +# docker.service. This supports service and Drop-In file changes by +# issuing a systemctl daemon reload after the patch is applied. +# + +# +# The patching subsystem provides a patch-functions bash source file +# with useful function and variable definitions. +# +. /etc/patching/patch-functions + +# +# Declare an overall script return code +# +declare -i GLOBAL_RC=$PATCH_STATUS_OK + +# Issue a systemd daemon-reload once the rpms have been installed and +# before the processes have been restarted. +systemctl daemon-reload + +# processes that run on all nodes +processes_to_restart="dockerd" +/usr/local/sbin/patch-restart-processes ${processes_to_restart} +if [ $? != 0 ] ; then + loginfo "patching restart failed" + loginfo "... process-restart ${processes_to_restart}" + exit ${PATCH_STATUS_FAILED} +fi + +# +# Exit the script with the overall return code +# +exit $GLOBAL_RC +