diff options
-rw-r--r-- | meta/classes/image.bbclass | 43 |
1 files changed, 37 insertions, 6 deletions
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass index 84ddc3872f..dd78acb7be 100644 --- a/meta/classes/image.bbclass +++ b/meta/classes/image.bbclass | |||
@@ -194,13 +194,41 @@ run_intercept_scriptlets () { | |||
194 | cd ${WORKDIR}/intercept_scripts | 194 | cd ${WORKDIR}/intercept_scripts |
195 | echo "Running intercept scripts:" | 195 | echo "Running intercept scripts:" |
196 | for script in *; do | 196 | for script in *; do |
197 | if [ "$script" = "*" ]; then break; fi | 197 | [ "$script" = "*" ] && break |
198 | [ "$script" = "postinst_intercept" ] || [ ! -x "$script" ] && continue | ||
198 | echo "> Executing $script" | 199 | echo "> Executing $script" |
199 | chmod +x $script | 200 | ./$script || (echo "WARNING: intercept script \"$script\" failed, falling back to running postinstalls at first boot" && continue) |
200 | ./$script | 201 | # |
201 | if [ $? -ne 0 ]; then | 202 | # If we got here, than the intercept was successful. Next, we must |
202 | echo "ERROR: intercept script \"$script\" failed!" | 203 | # mark the postinstalls as "installed". For rpm is a little bit |
203 | fi | 204 | # different, we just have to delete the saved postinstalls from |
205 | # /etc/rpm-postinsts | ||
206 | # | ||
207 | pkgs="$(cat ./$script|grep "^##PKGS"|cut -d':' -f2)" || continue | ||
208 | case ${IMAGE_PKGTYPE} in | ||
209 | "rpm") | ||
210 | for pi in ${IMAGE_ROOTFS}${sysconfdir}/rpm-postinsts/*; do | ||
211 | pkg_name="$(cat $pi|sed -n -e "s/^.*postinst_intercept $script \([^ ]*\).*/\1/p")" | ||
212 | if [ -n "$pkg_name" -a -n "$(echo "$pkgs"|grep " $pkg_name ")" ]; then | ||
213 | rm $pi | ||
214 | fi | ||
215 | done | ||
216 | # move to the next intercept script | ||
217 | continue | ||
218 | ;; | ||
219 | "ipk") | ||
220 | status_file="${IMAGE_ROOTFS}${OPKGLIBDIR}/opkg/status" | ||
221 | ;; | ||
222 | "deb") | ||
223 | status_file="${IMAGE_ROOTFS}/var/lib/dpkg/status" | ||
224 | ;; | ||
225 | esac | ||
226 | # the next piece of code is run only for ipk/dpkg | ||
227 | sed_expr="" | ||
228 | for p in $pkgs; do | ||
229 | sed_expr="$sed_expr -e \"/^Package: ${p}$/,/^Status: install.* unpacked$/ {s/unpacked/installed/}\"" | ||
230 | done | ||
231 | eval sed -i $sed_expr $status_file | ||
204 | done | 232 | done |
205 | fi | 233 | fi |
206 | } | 234 | } |
@@ -223,6 +251,9 @@ fakeroot do_rootfs () { | |||
223 | 251 | ||
224 | cp ${COREBASE}/meta/files/deploydir_readme.txt ${DEPLOY_DIR_IMAGE}/README_-_DO_NOT_DELETE_FILES_IN_THIS_DIRECTORY.txt || true | 252 | cp ${COREBASE}/meta/files/deploydir_readme.txt ${DEPLOY_DIR_IMAGE}/README_-_DO_NOT_DELETE_FILES_IN_THIS_DIRECTORY.txt || true |
225 | 253 | ||
254 | # copy the intercept scripts | ||
255 | cp ${COREBASE}/scripts/postinst-intercepts/* ${WORKDIR}/intercept_scripts/ | ||
256 | |||
226 | # If "${IMAGE_ROOTFS}/dev" exists, then the device had been made by | 257 | # If "${IMAGE_ROOTFS}/dev" exists, then the device had been made by |
227 | # the previous build | 258 | # the previous build |
228 | if [ "${USE_DEVFS}" != "1" -a ! -r "${IMAGE_ROOTFS}/dev" ]; then | 259 | if [ "${USE_DEVFS}" != "1" -a ! -r "${IMAGE_ROOTFS}/dev" ]; then |