[OE-core] [PATCH] base-passwd: Move update-passwd into a separate package

Phil Blundell philb at gnu.org
Mon Nov 14 15:15:52 UTC 2011


On Mon, 2011-11-14 at 13:57 +0000, Richard Purdie wrote:
> +pkg_postinst_${PN}-update () {
> +#!/bin/sh
> +if [ "x$D" != "x" ]; then
> +	exit 0
> +fi
> +${sbindir}/update-passwd
> +}

Not that it really matters, but (in the interests of not perpetuating
unnecessary cruft) this "x" paradigm is unnecessary here.  If you quote
the values then empty strings are permissible, so you could have
written:

if [ "$D" != "" ]; then
   ...
fi

But, in fact, all reasonable implementations of /bin/sh support "test
-n" (it's required by POSIX) so you can write it even more concisely:

if [ -n $D ]; then
  ...
fi

Of course, it sucks fairly badly that we need to have all this scar
tissue in the installed postinsts at all.  For the opkg backend at
least, it would be fairly straightforward to add support for an "offline
postinst" as a separate script, which could be run by rootfs_ipk but
never actually installed into the rootfs.  But I don't know what the
impact on the other backends would be for that, which I guess might make
it hard to deploy in practice.

p.






More information about the Openembedded-core mailing list