Skip to contentSkip to conversation

prelink_git.bb: Only block the postinst script when no image-prelink (v2)

PATCH In review Mark Hatle 3 participants 5 messages Jun 29, 2011 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Mark Hatle

author
#1 lore raw

PATCH 2/2 prelink_git.bb: Only block the postinst script when no image-prelink (v2)

[V2 - fix a small typo in the comment]

If image-prelink is being used, the system will automatically prelink the target image. This avoids the need to run the postinst prelink script at first boot. However, if the user has not enabled image prelinking -- then we do enable the script to run on first boot.

---
 meta/recipes-devtools/prelink/prelink_git.bb |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
meta/recipes-devtools/prelink/prelink_git.bb +4 -2
index b57c145..c653d4d 100644
@@ -10,7 +10,7 @@ LICENSE = "GPLv2"
 LIC_FILES_CHKSUM = "file://COPYING;md5=c93c0550bd3173f4504b2cbd8991e50b"
 SRCREV = "ac461e73b17253a4da25c5aafeac7193b553156c"
 PV = "1.0+git${SRCPV}"
-PR = "r3"
+PR = "r4"
 
 #
 # The cron script attempts to re-prelink the system daily -- on
@@ -58,11 +58,13 @@ do_install_append () {
 	install -m 0644 ${WORKDIR}/macros.prelink ${D}${sysconfdir}/rpm/macros.prelink
 }
 
+# If we're using image-prelink, we want to skip this on the host side
+# but still do it if the package is installed on the target...
 pkg_postinst_prelink() {
 #!/bin/sh
 
 if [ "x$D" != "x" ]; then
-  exit 1
+  ${@base_contains('USER_CLASSES', 'image-prelink', 'exit 0', 'exit 1', d)}
 fi
 
 prelink -a
Signature · 1 line
1.7.3.4
#2 lore raw
Quoted 13 lines · Mark Hatle

[V2 - fix a small typo in the comment]

If image-prelink is being used, the system will automatically prelink the target image. This avoids the need to run the postinst prelink script at first boot. However, if the user has not enabled image prelinking -- then we do enable the script to run on first boot.

# The cron script attempts to re-prelink the system daily -- on

meta/recipes-devtools/prelink/prelink_git.bb +1 -0
@@ -58,11 +58,13 @@ do_install_append () {
 	install -m 0644 ${WORKDIR}/macros.prelink
 ${D}${sysconfdir}/rpm/macros.prelink }
 
+# If we're using image-prelink, we want to skip this on the host side

meta/recipes-devtools/prelink/prelink_git.bb do_install_append () { · line 70

Quoted 10 lines
meta/recipes-devtools/prelink/prelink_git.bb +2 -1
+# but still do it if the package is installed on the target...
 pkg_postinst_prelink() {
 #!/bin/sh
 
 if [ "x$D" != "x" ]; then
-  exit 1
+  ${@base_contains('USER_CLASSES', 'image-prelink', 'exit 0', 'exit
 1', d)} fi
 
 prelink -a

Even if without the patch, we still skip this on the host side -- previously we skipped with "exit 1", and with the patch now we skip with "exit 1" or "exit 0". So IMHO looks the patch doesn't actually help? :-)

Thanks,
-- Dexuan

#3 lore raw
Quoted 2 lines · Dexuan

Even if without the patch, we still skip this on the host side -- previously we skipped with "exit 1", and with the patch now we skip with "exit 1" or "exit 0". So IMHO looks the patch doesn't actually help? :-)

If the script exits with 0 in offline mode then it won't get rerun at first boot on the target. If it exits with 1 then it will.

p.

author
#4 lore raw
Quoted 6 lines · Phil Blundell
Quoted 2 lines · Dexuan

Even if without the patch, we still skip this on the host side -- previously we skipped with "exit 1", and with the patch now we skip with "exit 1" or "exit 0". So IMHO looks the patch doesn't actually help? :-)

If the script exits with 0 in offline mode then it won't get rerun at first boot on the target. If it exits with 1 then it will.

Yes. Since we've already run the equivalent of the script in the image-prelink, we can safely exit with a '0' telling the "image" preinst code that this was successfully run and to ignore it at first boot.

--Mark

Quoted 8 lines

p.

_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

#5 lore raw
Quoted 7 lines · Mark Hatle
Quoted 6 lines · Phil Blundell
Quoted 4 lines · Dexuan

Even if without the patch, we still skip this on the host side -- previously we skipped with "exit 1", and with the patch now we skip with "exit 1" or "exit 0". So IMHO looks the patch doesn't actually help? :-)

Quoted 8 lines
Quoted 2 lines

If the script exits with 0 in offline mode then it won't get rerun at first boot on the target. If it exits with 1 then it will.

Yes. Since we've already run the equivalent of the script in the image-prelink, we can safely exit with a '0' telling the "image" preinst code that this was successfully run and to ignore it at first boot.

Ok, got it!

Thanks very much for the explanation!

Thanks,
-- Dexuan