summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorLaurentiu Palcu <laurentiu.palcu@intel.com>2013-04-22 11:01:25 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-05-22 17:13:53 +0100
commit3fecd5837062fcd6962c256cf777c93c0ac1005a (patch)
treed59af7125cacb343b8c4960ff0a20ba0c4179335 /meta/classes
parent690b8a1811f1ea20b57e13da3f4f599335fe0f73 (diff)
downloadpoky-3fecd5837062fcd6962c256cf777c93c0ac1005a.tar.gz
image.bbclass: change the logic when intercepts fail
Due to some issues with postinstalls that register hooks, we changed the logic a bit. Now, all postinstalls that register hooks will return successfully and only after, if hooks fail, mark the package as unpacked. (From OE-Core master rev: 82dae98d0eb771c05e57635f0f8763b118d8177e) (From OE-Core rev: 202f1b0e4ee6d912f2bec5991d1cd60bbb0c020e) Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/image.bbclass32
1 files changed, 22 insertions, 10 deletions
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 4e9c29cb8b..ffb372aebb 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -187,21 +187,32 @@ run_intercept_scriptlets () {
187 [ "$script" = "*" ] && break 187 [ "$script" = "*" ] && break
188 [ "$script" = "postinst_intercept" ] || [ ! -x "$script" ] && continue 188 [ "$script" = "postinst_intercept" ] || [ ! -x "$script" ] && continue
189 echo "> Executing $script" 189 echo "> Executing $script"
190 ./$script || { echo "WARNING: intercept script \"$script\" failed, falling back to running postinstalls at first boot" && continue; }; 190 ./$script && continue
191 echo "WARNING: intercept script \"$script\" failed, falling back to running postinstalls at first boot"
191 # 192 #
192 # If we got here, than the intercept was successful. Next, we must 193 # If we got here, than the intercept has failed. Next, we must
193 # mark the postinstalls as "installed". For rpm is a little bit 194 # mark the postinstalls as "unpacked". For rpm is a little bit
194 # different, we just have to delete the saved postinstalls from 195 # different, we just have to save the package postinstalls in
195 # /etc/rpm-postinsts 196 # /etc/rpm-postinsts
196 # 197 #
197 pkgs="$(cat ./$script|grep "^##PKGS"|cut -d':' -f2)" || continue 198 pkgs="$(cat ./$script|grep "^##PKGS"|cut -d':' -f2)" || continue
198 case ${IMAGE_PKGTYPE} in 199 case ${IMAGE_PKGTYPE} in
199 "rpm") 200 "rpm")
200 for pi in ${IMAGE_ROOTFS}${sysconfdir}/rpm-postinsts/*; do 201 [ -d ${IMAGE_ROOTFS}${sysconfdir}/rpm-postinsts/ ] || mkdir ${IMAGE_ROOTFS}${sysconfdir}/rpm-postinsts/
201 pkg_name="$(cat $pi|sed -n -e "s/^.*postinst_intercept $script \([^ ]*\).*/\1/p")" 202 v_expr=$(echo ${MULTILIB_GLOBAL_VARIANTS}|tr ' ' '|')
202 if [ -n "$pkg_name" -a -n "$(echo "$pkgs"|grep " $pkg_name ")" ]; then 203 for p in $pkgs; do
203 rm $pi 204 # remove any multilib prefix from the package name (RPM
204 fi 205 # does not use it like this)
206 new_p=$(echo $p | sed -r "s/^($v_expr)-//")
207
208 # extract the postinstall scriptlet from rpm package and
209 # save it in /etc/rpm-postinsts
210 echo " * postponing $new_p"
211 rpm -q --scripts --root=${IMAGE_ROOTFS} --dbpath=/var/lib/rpm $new_p |\
212 sed -n -e '/^postinstall scriptlet (using .*):$/,/^.* scriptlet (using .*):$/ {/.*/p}' |\
213 sed -e 's/postinstall scriptlet (using \(.*\)):$/#!\1/' -e '/^.* scriptlet (using .*):$/d'\
214 > ${IMAGE_ROOTFS}${sysconfdir}/rpm-postinsts/$new_p
215 chmod +x ${IMAGE_ROOTFS}${sysconfdir}/rpm-postinsts/$new_p
205 done 216 done
206 # move to the next intercept script 217 # move to the next intercept script
207 continue 218 continue
@@ -216,7 +227,8 @@ run_intercept_scriptlets () {
216 # the next piece of code is run only for ipk/dpkg 227 # the next piece of code is run only for ipk/dpkg
217 sed_expr="" 228 sed_expr=""
218 for p in $pkgs; do 229 for p in $pkgs; do
219 sed_expr="$sed_expr -e \"/^Package: ${p}$/,/^Status: install.* unpacked$/ {s/unpacked/installed/}\"" 230 echo " * postponing $p"
231 sed_expr="$sed_expr -e \"/^Package: ${p}$/,/^Status: install.* installed$/ {s/installed/unpacked/}\""
220 done 232 done
221 eval sed -i $sed_expr $status_file 233 eval sed -i $sed_expr $status_file
222 done 234 done