> -----Original Message----- > From: openembedded-core@lists.openembedded.org > <openembedded-core@lists.openembedded.org> On Behalf Of Joakim Tjernlund via > lists.openembedded.org > Sent: den 24 november 2023 15:11 > To: openembedded-core@lists.openembedded.org > Cc: Joakim Tjernlund <joakim.tjernl...@infinera.com> > Subject: [OE-core] [kirkstone][PATCH 4/4] shadow: Add PW_SUBDIR > > Add support for creating passwd files in a /etc subdir > Set PW_SUBIR to pwdb to get passwd files in /etc/pwdb > > Signed-off-by: Joakim Tjernlund <joakim.tjernl...@infinera.com> > --- > .../0001-Define-SUBUID_FILE-SUBGID_FILE.patch | 92 +++++++++++++++++++ > meta/recipes-extended/shadow/shadow.inc | 30 +++++- > 2 files changed, 118 insertions(+), 4 deletions(-) > create mode 100644 > meta/recipes-extended/shadow/files/0001-Define-SUBUID_FILE-SUBGID_FILE.patch > > diff --git > a/meta/recipes-extended/shadow/files/0001-Define-SUBUID_FILE-SUBGID_FILE.patch > > b/meta/recipes-extended/shadow/files/0001-Define-SUBUID_FILE-SUBGID_FILE.patch > new file mode 100644 > index 0000000000..9f85159e97 > --- /dev/null > +++ > b/meta/recipes-extended/shadow/files/0001-Define-SUBUID_FILE-SUBGID_FILE.patch > @@ -0,0 +1,92 @@ > +From f605fb315faef7ddcad70d638f3b3aa16ea98fc0 Mon Sep 17 00:00:00 2001 > +From: Joakim Tjernlund <joakim.tjernl...@infinera.com> > +Date: Thu, 2 Nov 2023 00:27:10 +0100 > +Subject: [PATCH] Define SUBUID_FILE/SUBGID_FILE > + > +Upstream-Status: Backport, > https://github.com/shadow-maint/shadow/commit/ee3a79c6952f8ca649c286c7f76639d9d1dedaad
Follow the recommended syntax: Upstream-Status: Backport [https://github.com/shadow-maint/shadow/commit/ee3a79c6952f8ca649c286c7f76639d9d1dedaad] > + > +These where hard coded, make them definable like SHADOW_FILE > + > +Signed-off-by: Joakim Tjernlund <joakim.tjernl...@infinera.com> > +--- [cut] > diff --git a/meta/recipes-extended/shadow/shadow.inc > b/meta/recipes-extended/shadow/shadow.inc > index 3c1dd2f98e..bcb9b09a49 100644 > --- a/meta/recipes-extended/shadow/shadow.inc > +++ b/meta/recipes-extended/shadow/shadow.inc > @@ -18,6 +18,7 @@ SRC_URI = > "https://github.com/shadow-maint/shadow/releases/download/v${PV}/${BP} > file://useradd \ > file://CVE-2023-29383.patch \ > file://0001-Overhaul-valid_field.patch \ > + file://0001-Define-SUBUID_FILE-SUBGID_FILE.patch \ > " > > SRC_URI:append:class-target = " \ > @@ -46,6 +47,21 @@ PAM_SRC_URI = "file://pam.d/chfn \ > file://pam.d/passwd \ > file://pam.d/su" > > +#Set PW_SUBDIR to pwdb to get passwd files in /etc/pwdb > +PW_SUBDIR ?= "" > +PWPRE = "/etc/${PW_SUBDIR}" Use ${sysconfdir} instead of /etc. > +CFLAGS:append = ' -DPASSWD_FILE=\\"${PWPRE}/passwd\\"' > +CFLAGS:append = ' -DSHADOW_FILE=\\"${PWPRE}/shadow\\"' > +CFLAGS:append = ' -DGROUP_FILE=\\"${PWPRE}/group\\"' > +CFLAGS:append = ' -DSGROUP_FILE=\\"${PWPRE}/gshadow\\"' > +CFLAGS:append = ' -DSUBUID_FILE=\\"${PWPRE}/subuid\\"' > +CFLAGS:append = ' -DSUBGID_FILE=\\"${PWPRE}/subgid\\"' Use `CFLAGS += ...` instead of `CFLAGS:append = ...`: CFLAGS += ' \ -DPASSWD_FILE=\\"${PWPRE}/passwd\\" \ -DSHADOW_FILE=\\"${PWPRE}/shadow\\" \ -DGROUP_FILE=\\"${PWPRE}/group\\" \ -DSGROUP_FILE=\\"${PWPRE}/gshadow\\" \ -DSUBUID_FILE=\\"${PWPRE}/subuid\\" \ -DSUBGID_FILE=\\"${PWPRE}/subgid\\" \ ' > + > +#shadow has it own impl. that uses whatever dir passwd files are in > +do_configure:prepend () { > + sed -i -e 's/lckpwdf//' ${S}/configure.ac Use tabs to indent shell code. However, this should really be a patch... > +} > + > inherit autotools gettext > > export CONFIG_SHELL="/bin/sh" > @@ -157,9 +173,9 @@ do_install:append() { > # usermod requires the subuid/subgid files to be in place before being > # able to use the -v/-V flags otherwise it fails: > # usermod: /etc/subuid does not exist, you cannot use the flags -v or -V > - install -d ${D}${sysconfdir} > - touch ${D}${sysconfdir}/subuid > - touch ${D}${sysconfdir}/subgid > + install -d ${D}${sysconfdir}/${PW_SUBDIR} > + touch ${D}${sysconfdir}/${PW_SUBDIR}/subuid > + touch ${D}${sysconfdir}/${PW_SUBDIR}/subgid > } > > PACKAGES =+ "${PN}-base" > @@ -193,12 +209,18 @@ ALTERNATIVE_LINK_NAME[su] = "${base_bindir}/su" > > PACKAGE_WRITE_DEPS += "shadow-native" > pkg_postinst:${PN}:class-target () { > + install -d $D${sysconfdir}/${PW_SUBDIR} > if [ "x$D" != "x" ]; then > rootarg="--root $D" > else > rootarg="" > fi > - > + if [ -n "${PW_SUBDIR}" ]; then > + ln -fs ${PW_SUBDIR}/subuid $D${sysconfdir}/subuid > + ln -fs ${PW_SUBDIR}/subgid $D${sysconfdir}/subgid > + ln -fs ${PW_SUBDIR}/shadow $D${sysconfdir}/shadow > + ln -fs ${PW_SUBDIR}/gshadow $D${sysconfdir}/gshadow Inconsistent indentation (mix of tabs and spaces). This also applies to the old code above, but with a different number of spaces... > + fi > pwconv $rootarg || exit 1 > grpconv $rootarg || exit 1 > } > -- > 2.41.0 //Peter
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#191240): https://lists.openembedded.org/g/openembedded-core/message/191240 Mute This Topic: https://lists.openembedded.org/mt/102780970/21656 Group Owner: openembedded-core+ow...@lists.openembedded.org Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-