On Sun, Jun 23, 2024 at 01:48:02PM +0200, Chris Hofstaedtler wrote:
> Colin, what do you think? Can/should base-passwd create /etc/subuid,
> /etc/subgid on new installs and upgrades?

Attached is a draft patch to do this in base-passwd. It is an
almost verbatim copy of what login.postinst did so far.

Thanks for considering,
Chris

>From f4f18561cf06129db0a6802ea1072adabe6fff56 Mon Sep 17 00:00:00 2001
From: Chris Hofstaedtler <[email protected]>
Date: Sun, 23 Jun 2024 15:52:21 +0200
Subject: [PATCH] Create /etc/sub{u,g}id

---
 debian/postinst | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/debian/postinst b/debian/postinst
index b351e7d..262ae29 100644
--- a/debian/postinst
+++ b/debian/postinst
@@ -64,6 +64,19 @@ if [ ! -e "$DPKG_ROOT/etc/group" ] ; then
 	cp "$DPKG_ROOT/usr/share/base-passwd/group.master" "$DPKG_ROOT/etc/group"
 fi
 
+if [ ! -e "$DPKG_ROOT/etc/subuid" ] ; then
+	touch "$DPKG_ROOT/etc/subuid"
+	chown 0:0 "$DPKG_ROOT/etc/subuid"
+	chmod 644 "$DPKG_ROOT/etc/subuid"
+fi
+
+if [ ! -e "$DPKG_ROOT/etc/subgid" ] ; then
+	touch "$DPKG_ROOT/etc/subgid"
+	chown 0:0 "$DPKG_ROOT/etc/subgid"
+	chmod 644 "$DPKG_ROOT/etc/subgid"
+fi
+
+
 tmp=$(mktemp)
 if [ -n "$2" ] && ! update-passwd --dry-run > "$tmp" ; then
 	if [ -f /usr/share/debconf/confmodule ] ; then
-- 
2.39.2

_______________________________________________
Pkg-shadow-devel mailing list
[email protected]
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/pkg-shadow-devel

Reply via email to