From 4670e93b92ba39960c59c704b2c2028de853859d Mon Sep 17 00:00:00 2001 From: Eli Uriegas Date: Wed, 15 Aug 2018 23:13:21 +0000 Subject: [PATCH] Revive pre / post steps, update offline location Signed-off-by: Eli Uriegas Upstream-commit: 558cd9c4bb28a11fe1ff3da45a4efd19265d7ce5 Component: packaging --- components/packaging/rpm/SPECS/docker-ce.spec | 46 +++++++++---------- components/packaging/systemd/docker.service | 2 +- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/components/packaging/rpm/SPECS/docker-ce.spec b/components/packaging/rpm/SPECS/docker-ce.spec index e5714f176c..77cda6a7f2 100644 --- a/components/packaging/rpm/SPECS/docker-ce.spec +++ b/components/packaging/rpm/SPECS/docker-ce.spec @@ -62,29 +62,29 @@ popd %install # Install containerd-proxy as dockerd install -D -m 0755 %{_topdir}/BUILD/src/containerd-proxy/bin/containerd-proxy $RPM_BUILD_ROOT/%{_bindir}/dockerd -install -D -m 0644 %{_topdir}/SOURCES/containerd-shim-process.tar $RPM_BUILD_ROOT/%{_sharedstatedir}/containerd/containerd-shim-process.tar +install -D -m 0644 %{_topdir}/SOURCES/containerd-shim-process.tar $RPM_BUILD_ROOT/%{_sharedstatedir}/containerd-offline-installer/containerd-shim-process.tar install -D -m 0644 %{_topdir}/SOURCES/docker.service $RPM_BUILD_ROOT/%{_unitdir}/docker.service install -D -m 0644 %{_topdir}/SOURCES/dockerd.json $RPM_BUILD_ROOT/etc/containerd-proxy/dockerd.json %files /%{_bindir}/dockerd -/%{_sharedstatedir}/containerd/containerd-shim-process.tar +/%{_sharedstatedir}/containerd-offline-installer/containerd-shim-process.tar /%{_unitdir}/docker.service /etc/containerd-proxy/dockerd.json %pre -# if [ $1 -gt 0 ] ; then -# # package upgrade scenario, before new files are installed -# -# # clear any old state -# rm -f %{_localstatedir}/lib/rpm-state/docker-is-active > /dev/null 2>&1 || : -# -# # check if docker service is running -# if systemctl is-active docker > /dev/null 2>&1; then -# systemctl stop docker > /dev/null 2>&1 || : -# touch %{_localstatedir}/lib/rpm-state/docker-is-active > /dev/null 2>&1 || : -# fi -# fi +if [ $1 -gt 0 ] ; then + # package upgrade scenario, before new files are installed + + # clear any old state + rm -f %{_localstatedir}/lib/rpm-state/docker-is-active > /dev/null 2>&1 || : + + # check if docker service is running + if systemctl is-active docker > /dev/null 2>&1; then + systemctl stop docker > /dev/null 2>&1 || : + touch %{_localstatedir}/lib/rpm-state/docker-is-active > /dev/null 2>&1 || : + fi +fi %post %systemd_post docker @@ -99,14 +99,14 @@ fi %systemd_postun_with_restart docker %posttrans -# if [ $1 -ge 0 ] ; then -# # package upgrade scenario, after new files are installed -# -# # check if docker was running before upgrade -# if [ -f %{_localstatedir}/lib/rpm-state/docker-is-active ]; then -# systemctl start docker > /dev/null 2>&1 || : -# rm -f %{_localstatedir}/lib/rpm-state/docker-is-active > /dev/null 2>&1 || : -# fi -# fi +if [ $1 -ge 0 ] ; then + # package upgrade scenario, after new files are installed + + # check if docker was running before upgrade + if [ -f %{_localstatedir}/lib/rpm-state/docker-is-active ]; then + systemctl start docker > /dev/null 2>&1 || : + rm -f %{_localstatedir}/lib/rpm-state/docker-is-active > /dev/null 2>&1 || : + fi +fi %changelog diff --git a/components/packaging/systemd/docker.service b/components/packaging/systemd/docker.service index 438d8bb5ef..b03133fe1f 100644 --- a/components/packaging/systemd/docker.service +++ b/components/packaging/systemd/docker.service @@ -6,7 +6,7 @@ Wants=network-online.target containerd.service [Service] # Install containerd-shim-process if it's not already installed -ExecStartPre=/usr/libexec/containerd-offline-installer /var/lib/containerd/containerd-shim-process.tar docker.io/docker/containerd-shim-process +ExecStartPre=/usr/libexec/containerd-offline-installer /var/lib/containerd-offline-installer/containerd-shim-process.tar docker.io/docker/containerd-shim-process ExecStart=/usr/bin/dockerd TimeoutSec=infinity KillMode=process