[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Moving root password management and first user creation out of 2nd stage



On Mon, Oct 03, 2005 at 07:38:19PM +0200, Petter Reinholdtsen wrote:
> [Christian Perrier]
> > I guess that after apt-setup, the next target on Joey's attempts to
> > reduce base-config to nothing might be the steps actually involving
> > shadow.
> 
> I agree, it is a good idea to move this step to the first stage.
> 
> I believe Ubuntu already created some udeb to do this.  Perhaps check
> out what they got?

It's essentially just debconf-copydb plus 'dpkg-reconfigure passwd' over
passthrough, as Joey mentioned; but I agree with Joey that it would be
better to deal with all of base-config at once rather than creating lots
of little udebs.

I've attached the postinst of the Ubuntu udeb anyway, in case anyone's
interested. It does suggest some issues which might be relevant while
doing the same thing to base-config.

Cheers,

-- 
Colin Watson                                       [cjwatson@debian.org]
#! /bin/sh -e

. /usr/share/debconf/confmodule

db_get debian-installer/locale
if [ "$RET" ]; then
	TARGETLANG="$RET"
else
	TARGETLANG=C
fi

db_get debconf/priority
TARGETPRIO="$RET"

target_debconf () {
	env -u DEBIAN_HAS_FRONTEND -u DEBIAN_FRONTEND \
		-u DEBCONF_REDIR -u DEBCONF_OLD_FD_BASE \
		DEBCONF_READFD=0 DEBCONF_WRITEFD=3 \
		DEBIAN_PRIORITY="$TARGETPRIO" \
		LANG="$TARGETLANG" DEBCONF_RECONFIGURE=1 \
		chroot /target debconf -o base-config "$@"
}

debconf-copydb -p ^passwd/ configdb target_configdb

# Ideally, dpkg-reconfigure wouldn't create a new frontend every time. In
# the meantime, we reimplement a couple of bits of it. Note that
# DEBCONF_RECONFIGURE=1 is set in target_debconf above.

version="$(LANG="$TARGETLANG" chroot /target dpkg --status passwd | \
	   grep ^Version: | sed 's/^Version: //')"
CODE=0
target_debconf -f passthrough \
	/var/lib/dpkg/info/passwd.config reconfigure "$version" || CODE="$?"
if [ "$CODE" = 30 ]; then
	exit 10
else
	exit $CODE
fi

Reply to: