diff options
author | Laurentiu Palcu <laurentiu.palcu@intel.com> | 2013-04-11 14:09:25 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-04-11 12:20:38 +0100 |
commit | 98c1f5b1eae3162ebcce43011eeccb46bcbf49f1 (patch) | |
tree | 0d6b3126aa5ad3159f58486865ee29551652b82c | |
parent | 98b7d1d6a215f33a0a00faf24f90575e657b626f (diff) | |
download | poky-98c1f5b1eae3162ebcce43011eeccb46bcbf49f1.tar.gz |
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>
-rw-r--r-- | meta/recipes-devtools/dpkg/dpkg.inc | 23 | ||||
-rw-r--r-- | meta/recipes-devtools/opkg/opkg.inc | 3 | ||||
-rw-r--r-- | meta/recipes-devtools/rpm/rpm-postinsts.bb | 19 |
3 files changed, 28 insertions, 17 deletions
diff --git a/meta/recipes-devtools/dpkg/dpkg.inc b/meta/recipes-devtools/dpkg/dpkg.inc index 6bb1e16617..555492089f 100644 --- a/meta/recipes-devtools/dpkg/dpkg.inc +++ b/meta/recipes-devtools/dpkg/dpkg.inc | |||
@@ -39,15 +39,6 @@ POSTLOG ?= "/var/log/postinstall.log" | |||
39 | REDIRECT_CMD = "${@base_contains('IMAGE_FEATURES', 'debug-tweaks', '>${POSTLOG} 2>&1', '', d)}" | 39 | REDIRECT_CMD = "${@base_contains('IMAGE_FEATURES', 'debug-tweaks', '>${POSTLOG} 2>&1', '', d)}" |
40 | 40 | ||
41 | DPKG_INIT_POSITION ?= "98" | 41 | DPKG_INIT_POSITION ?= "98" |
42 | do_install_prepend () { | ||
43 | install -d ${D}/${sysconfdir}/rcS.d | ||
44 | # this happens at S98 where our good 'ole packages script used to run | ||
45 | echo "#!/bin/sh | ||
46 | dpkg --configure -a ${REDIRECT_CMD} | ||
47 | rm -f ${sysconfdir}/rcS.d/S${DPKG_INIT_POSITION}run-postinsts | ||
48 | " > ${D}/${sysconfdir}/rcS.d/S${DPKG_INIT_POSITION}run-postinsts | ||
49 | chmod 0755 ${D}/${sysconfdir}/rcS.d/S${DPKG_INIT_POSITION}run-postinsts | ||
50 | } | ||
51 | 42 | ||
52 | do_install_append () { | 43 | do_install_append () { |
53 | if [ "${PN}" = "dpkg-native" ]; then | 44 | if [ "${PN}" = "dpkg-native" ]; then |
@@ -67,6 +58,20 @@ do_install_append_class-native () { | |||
67 | done | 58 | done |
68 | } | 59 | } |
69 | 60 | ||
61 | pkg_postinst_${PN} () { | ||
62 | #!/bin/sh | ||
63 | if [ "x$D" != "x" ] && [ -f $D/var/lib/dpkg/status ]; then | ||
64 | install -d ${D}/${sysconfdir}/rcS.d | ||
65 | |||
66 | # this happens at S98 where our good 'ole packages script used to run | ||
67 | echo "#!/bin/sh | ||
68 | dpkg --configure -a ${REDIRECT_CMD} | ||
69 | rm -f ${sysconfdir}/rcS.d/S${DPKG_INIT_POSITION}run-postinsts | ||
70 | " > ${D}/${sysconfdir}/rcS.d/S${DPKG_INIT_POSITION}run-postinsts | ||
71 | chmod 0755 ${D}/${sysconfdir}/rcS.d/S${DPKG_INIT_POSITION}run-postinsts | ||
72 | fi | ||
73 | } | ||
74 | |||
70 | PROV = "virtual/update-alternatives" | 75 | PROV = "virtual/update-alternatives" |
71 | PROV_class-native = "" | 76 | PROV_class-native = "" |
72 | 77 | ||
diff --git a/meta/recipes-devtools/opkg/opkg.inc b/meta/recipes-devtools/opkg/opkg.inc index f9c120257b..ff26b04b6e 100644 --- a/meta/recipes-devtools/opkg/opkg.inc +++ b/meta/recipes-devtools/opkg/opkg.inc | |||
@@ -62,8 +62,9 @@ REDIRECT_CMD = "${@base_contains('IMAGE_FEATURES', 'debug-tweaks', '>${POSTLOG} | |||
62 | 62 | ||
63 | pkg_postinst_${PN} () { | 63 | pkg_postinst_${PN} () { |
64 | #!/bin/sh | 64 | #!/bin/sh |
65 | if [ "x$D" != "x" ]; then | 65 | if [ "x$D" != "x" ] && [ -f $D/var/lib/opkg/status ]; then |
66 | install -d $D${sysconfdir}/rcS.d | 66 | install -d $D${sysconfdir}/rcS.d |
67 | |||
67 | # this happens at S98 where our good 'ole packages script used to run | 68 | # this happens at S98 where our good 'ole packages script used to run |
68 | echo "#!/bin/sh | 69 | echo "#!/bin/sh |
69 | opkg-cl configure ${REDIRECT_CMD} | 70 | opkg-cl configure ${REDIRECT_CMD} |
diff --git a/meta/recipes-devtools/rpm/rpm-postinsts.bb b/meta/recipes-devtools/rpm/rpm-postinsts.bb index fb05ad6d51..b551c8d4f0 100644 --- a/meta/recipes-devtools/rpm/rpm-postinsts.bb +++ b/meta/recipes-devtools/rpm/rpm-postinsts.bb | |||
@@ -27,15 +27,17 @@ do_compile() { | |||
27 | } | 27 | } |
28 | 28 | ||
29 | do_install() { | 29 | do_install() { |
30 | install -d ${D}/${sysconfdir}/rcS.d | 30 | : |
31 | # Stop $i getting expanded below... | 31 | } |
32 | i=\$i | ||
33 | cat > ${D}${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts << EOF | ||
34 | #!/bin/sh | ||
35 | 32 | ||
33 | pkg_postinst_${PN} () { | ||
34 | if [ "x$D" != "x" ] && [ -f $D/var/lib/rpm/Packages ]; then | ||
35 | install -d $D/${sysconfdir}/rcS.d | ||
36 | cat > $D${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts << "EOF" | ||
37 | #!/bin/sh | ||
36 | . /etc/default/rcS | 38 | . /etc/default/rcS |
37 | 39 | ||
38 | [ -d /etc/rpm-postinsts ] && for i in \`ls /etc/rpm-postinsts/ \`; do | 40 | [ -d /etc/rpm-postinsts ] && for i in `ls /etc/rpm-postinsts/`; do |
39 | i=/etc/rpm-postinsts/$i | 41 | i=/etc/rpm-postinsts/$i |
40 | echo "Running postinst $i..." | 42 | echo "Running postinst $i..." |
41 | if [ -f $i ] && $i ${REDIRECT_CMD}; then | 43 | if [ -f $i ] && $i ${REDIRECT_CMD}; then |
@@ -46,5 +48,8 @@ do_install() { | |||
46 | done | 48 | done |
47 | rm -f ${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts 2>/dev/null | 49 | rm -f ${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts 2>/dev/null |
48 | EOF | 50 | EOF |
49 | chmod 0755 ${D}${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts | 51 | chmod 0755 $D${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts |
52 | fi | ||
50 | } | 53 | } |
54 | |||
55 | ALLOW_EMPTY_${PN} = "1" | ||