Skip to content
This repository was archived by the owner on Oct 13, 2023. It is now read-only.

Commit 47b5cbe

Browse files
committed
Remove the pre and posttrans, they weren't useful
On some distros we were encountering errors where `$1` was not being populated for the 'pre' and 'posttrans' rpm macros, upon closer inspection it isn't exactly clear why the pre and posttrans macro scripts were exactly useful since the `%systemd_postun_with_restart` does exactly what those scripts were doing. I've tidied up the systemd macros to use `docker.service` instead of `docker` which seems to function as we'd expect. taken from downstream commit 62d8413b550659a0b5318346ee2e3d7e4a50bfe1 Signed-off-by: Eli Uriegas <eli.uriegas@docker.com> Signed-off-by: Sebastiaan van Stijn <github@gone.nl> (cherry picked from commit bece037) Signed-off-by: Sebastiaan van Stijn <github@gone.nl> Upstream-commit: 12b807d90a892c185e98ab38d4eea759d61e1ee9 Component: packaging
1 parent 10e7a7e commit 47b5cbe

1 file changed

Lines changed: 3 additions & 28 deletions

File tree

components/packaging/rpm/SPECS/docker-ce.spec

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -114,41 +114,16 @@ install -D -m 0644 %{_topdir}/SOURCES/distribution_based_engine.json $RPM_BUILD_
114114
/%{_unitdir}/docker.socket
115115
/var/lib/docker-engine/distribution_based_engine-ce.json
116116

117-
%pre
118-
if [ $1 -gt 0 ] ; then
119-
# package upgrade scenario, before new files are installed
120-
121-
# clear any old state
122-
rm -f %{_localstatedir}/lib/rpm-state/docker-is-active > /dev/null 2>&1 || :
123-
124-
# check if docker service is running
125-
if systemctl is-active docker > /dev/null 2>&1; then
126-
systemctl stop docker > /dev/null 2>&1 || :
127-
touch %{_localstatedir}/lib/rpm-state/docker-is-active > /dev/null 2>&1 || :
128-
fi
129-
fi
130-
131117
%post
132-
%systemd_post docker
118+
%systemd_post docker.service
133119
if ! getent group docker > /dev/null; then
134120
groupadd --system docker
135121
fi
136122

137123
%preun
138-
%systemd_preun docker
124+
%systemd_preun docker.service
139125

140126
%postun
141-
%systemd_postun_with_restart docker
142-
143-
%posttrans
144-
if [ $1 -ge 0 ] ; then
145-
# package upgrade scenario, after new files are installed
146-
147-
# check if docker was running before upgrade
148-
if [ -f %{_localstatedir}/lib/rpm-state/docker-is-active ]; then
149-
systemctl start docker > /dev/null 2>&1 || :
150-
rm -f %{_localstatedir}/lib/rpm-state/docker-is-active > /dev/null 2>&1 || :
151-
fi
152-
fi
127+
%systemd_postun_with_restart docker.service
153128

154129
%changelog

0 commit comments

Comments
 (0)