Skip to content

deb: use symlink to install systemd-sysusers #1196

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion deb/common/control
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Build-Depends: bash,
ca-certificates,
cmake,
dh-apparmor,
debhelper-compat (= 12),
debhelper-compat (= 13),
gcc,
git,
libc-dev,
Expand Down
1 change: 1 addition & 0 deletions deb/common/docker-ce.docker.sysusers
20 changes: 0 additions & 20 deletions deb/common/docker-ce.postinst

This file was deleted.

4 changes: 4 additions & 0 deletions deb/common/rules
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ override_dh_installsystemd:
# use "docker" as our service name, not "docker-ce"
dh_installsystemd --name=docker

override_dh_installsysusers:
# use "docker" as our service name, not "docker-ce"
dh_installsysusers --name=docker

Comment on lines +144 to +147
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried adding this, but that also doesn't seem to do the trick 😞 😢

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I figured out what's missing -- it's not added to the sequence by default until debhelper 14 (which is still a dev version), but if you add dh-sequence-installsysusers to Build-Depends, it should inject it. I've implemented this successfully in my own packages in tianon/debian-moby#24 👍

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for digging!! We ultimately backed out the patch for now (I thought my patch worked, but turned out it didn't pick up the feature), but @p5 also started to try and fix it.

I think with this info, we have a path forward to bring it back in ❤️

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So in theory, this should be enough:

$ git --no-pager diff --staged --irreversible-delete
diff --git a/deb/common/control b/deb/common/control
index e2438b9..48b9561 100644
--- a/deb/common/control
+++ b/deb/common/control
@@ -6,8 +6,9 @@ Build-Depends: bash,
                bash-completion,
                ca-certificates,
                cmake,
+               debhelper-compat (= 13),
                dh-apparmor,
-               debhelper-compat (= 12),
+               dh-sequence-installsysusers,
                gcc,
                git,
                libc-dev,
diff --git a/deb/common/docker-ce.docker.sysusers b/deb/common/docker-ce.docker.sysusers
new file mode 120000
index 0000000..eddc903
--- /dev/null
+++ b/deb/common/docker-ce.docker.sysusers
@@ -0,0 +1 @@
+../engine/contrib/systemd-sysusers/docker.conf
\ No newline at end of file
diff --git a/deb/common/docker-ce.postinst b/deb/common/docker-ce.postinst
deleted file mode 100755
index eeef6ca..0000000
diff --git a/deb/common/rules b/deb/common/rules
index a25eae2..3fd39ae 100755
--- a/deb/common/rules
+++ b/deb/common/rules
@@ -141,6 +141,10 @@ override_dh_installsystemd:
 	# use "docker" as our service name, not "docker-ce"
 	dh_installsystemd --name=docker
 
+override_dh_installsysusers:
+	# use "docker" as our service name, not "docker-ce"
+	dh_installsysusers --name=docker
+
 override_dh_shlibdeps:
 	dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info
 

override_dh_shlibdeps:
dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info

Expand Down
7 changes: 4 additions & 3 deletions rpm/SPECS/docker-ce.spec
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ install -D -p -m 0755 $(readlink -f engine/bundles/dynbinary-daemon/dockerd) ${R
install -D -p -m 0755 $(readlink -f engine/bundles/dynbinary-daemon/docker-proxy) ${RPM_BUILD_ROOT}%{_bindir}/docker-proxy
install -D -p -m 0755 /usr/local/bin/docker-init ${RPM_BUILD_ROOT}%{_libexecdir}/docker/docker-init

# install systemd sysusers config
install -D -p -m 0644 engine/contrib/systemd-sysusers/docker.conf ${RPM_BUILD_ROOT}%{_sysusersdir}/docker.conf

# install systemd scripts
install -D -p -m 0644 engine/contrib/init/systemd/docker.service ${RPM_BUILD_ROOT}%{_unitdir}/docker.service
install -D -p -m 0644 engine/contrib/init/systemd/docker.socket ${RPM_BUILD_ROOT}%{_unitdir}/docker.socket
Expand All @@ -100,14 +103,12 @@ mkdir -p ${RPM_BUILD_ROOT}/etc/docker
%{_libexecdir}/docker/docker-init
%{_unitdir}/docker.service
%{_unitdir}/docker.socket
%{_sysusersdir}/docker.conf
%{_mandir}/man*/*
%dir /etc/docker

%post
%systemd_post docker.service
if ! getent group docker > /dev/null; then
groupadd --system docker
fi

%preun
%systemd_preun docker.service docker.socket
Expand Down
Loading