dpkg, opkg, rpm-postinst: fix overwriting the run-postinstall script

If multiple package managers are installed in the image, they will
overwrite each other's run-postinsts script, resulting in postinstalls
not beeing run at all at first boot.

What this patch does:
 * checks whether opkg/dpks/rpm is actually used to install
   the packages and, only after, creates the run-postinsts script;
 * brings dpkg recipe in sync with opkg: moves the script creation from
   do_install to postinstall;
 * move creation of run-postinsts script (rpm-postinsts recipe) to the
   postinstall scriptlet in order to better control the creation of the
   script according to the package manager used;

[YOCTO #4231]
[YOCTO #4179]

(From OE-Core rev: d7fd56df0a4954954d6d0764ae06beb869e6b99a)

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Laurentiu Palcu
2013-04-11 14:09:25 +03:00
committed by Richard Purdie
parent 98b7d1d6a2
commit 98c1f5b1ea
3 changed files with 28 additions and 17 deletions

View File

@@ -27,15 +27,17 @@ do_compile() {
}
do_install() {
install -d ${D}/${sysconfdir}/rcS.d
# Stop $i getting expanded below...
i=\$i
cat > ${D}${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts << EOF
#!/bin/sh
:
}
pkg_postinst_${PN} () {
if [ "x$D" != "x" ] && [ -f $D/var/lib/rpm/Packages ]; then
install -d $D/${sysconfdir}/rcS.d
cat > $D${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts << "EOF"
#!/bin/sh
. /etc/default/rcS
[ -d /etc/rpm-postinsts ] && for i in \`ls /etc/rpm-postinsts/ \`; do
[ -d /etc/rpm-postinsts ] && for i in `ls /etc/rpm-postinsts/`; do
i=/etc/rpm-postinsts/$i
echo "Running postinst $i..."
if [ -f $i ] && $i ${REDIRECT_CMD}; then
@@ -46,5 +48,8 @@ do_install() {
done
rm -f ${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts 2>/dev/null
EOF
chmod 0755 ${D}${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts
chmod 0755 $D${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts
fi
}
ALLOW_EMPTY_${PN} = "1"