diff options
| author | Richard Purdie <richard@openedhand.com> | 2006-11-21 23:21:06 +0000 |
|---|---|---|
| committer | Richard Purdie <richard@openedhand.com> | 2006-11-21 23:21:06 +0000 |
| commit | e2f9e1a4aa15ace73ec174aa24dd0db1a0924148 (patch) | |
| tree | f758eb2d6e8af9e772e5c9b59a03ba3b39d9f201 | |
| parent | 01b1dbaefdfcb78aef2f5a480046b56a04f90e6f (diff) | |
| download | poky-e2f9e1a4aa15ace73ec174aa24dd0db1a0924148.tar.gz | |
Factor common code out of rootfs_xxx.bbclass into image.bbclass. Add error detection code for roofs_deb.bbclass
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@936 311d38ba-8fff-0310-9ca6-ca027cbcb966
| -rw-r--r-- | meta/classes/image.bbclass | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass index 752b2de0b0..8375d7133e 100644 --- a/meta/classes/image.bbclass +++ b/meta/classes/image.bbclass | |||
| @@ -1,5 +1,7 @@ | |||
| 1 | inherit rootfs_${IMAGE_PKGTYPE} | 1 | inherit rootfs_${IMAGE_PKGTYPE} |
| 2 | 2 | ||
| 3 | PACKAGES = "" | ||
| 4 | |||
| 3 | # We need to recursively follow RDEPENDS and RRECOMMENDS for images | 5 | # We need to recursively follow RDEPENDS and RRECOMMENDS for images |
| 4 | BUILD_ALL_DEPS = "1" | 6 | BUILD_ALL_DEPS = "1" |
| 5 | do_rootfs[recrdeptask] = "do_package_write" | 7 | do_rootfs[recrdeptask] = "do_package_write" |
| @@ -9,6 +11,8 @@ EXCLUDE_FROM_WORLD = "1" | |||
| 9 | 11 | ||
| 10 | USE_DEVFS ?= "0" | 12 | USE_DEVFS ?= "0" |
| 11 | 13 | ||
| 14 | PID = "${@os.getpid()}" | ||
| 15 | |||
| 12 | DEPENDS += "makedevs-native" | 16 | DEPENDS += "makedevs-native" |
| 13 | PACKAGE_ARCH = "${MACHINE_ARCH}" | 17 | PACKAGE_ARCH = "${MACHINE_ARCH}" |
| 14 | 18 | ||
| @@ -26,6 +30,17 @@ DEPENDS += "${@get_image_deps(d)}" | |||
| 26 | IMAGE_DEVICE_TABLE ?= "${@bb.which(bb.data.getVar('BBPATH', d, 1), 'files/device_table-minimal.txt')}" | 30 | IMAGE_DEVICE_TABLE ?= "${@bb.which(bb.data.getVar('BBPATH', d, 1), 'files/device_table-minimal.txt')}" |
| 27 | IMAGE_POSTPROCESS_COMMAND ?= "" | 31 | IMAGE_POSTPROCESS_COMMAND ?= "" |
| 28 | 32 | ||
| 33 | # some default locales | ||
| 34 | IMAGE_LINGUAS ?= "de-de fr-fr en-gb" | ||
| 35 | |||
| 36 | LINGUAS_INSTALL = "${@" ".join(map(lambda s: "locale-base-%s" % s, bb.data.getVar('IMAGE_LINGUAS', d, 1).split()))}" | ||
| 37 | |||
| 38 | ROOTFS_POSTPROCESS_COMMAND ?= "" | ||
| 39 | |||
| 40 | do_rootfs[nostamp] = 1 | ||
| 41 | do_rootfs[dirs] = ${TOPDIR} | ||
| 42 | do_build[nostamp] = 1 | ||
| 43 | |||
| 29 | # Must call real_do_rootfs() from inside here, rather than as a separate | 44 | # Must call real_do_rootfs() from inside here, rather than as a separate |
| 30 | # task, so that we have a single fakeroot context for the whole process. | 45 | # task, so that we have a single fakeroot context for the whole process. |
| 31 | fakeroot do_rootfs () { | 46 | fakeroot do_rootfs () { |
| @@ -56,3 +71,50 @@ fakeroot do_rootfs () { | |||
| 56 | 71 | ||
| 57 | ${IMAGE_POSTPROCESS_COMMAND} | 72 | ${IMAGE_POSTPROCESS_COMMAND} |
| 58 | } | 73 | } |
| 74 | |||
| 75 | log_check() { | ||
| 76 | set +x | ||
| 77 | for target in $* | ||
| 78 | do | ||
| 79 | lf_path="${WORKDIR}/temp/log.do_$target.${PID}" | ||
| 80 | |||
| 81 | echo "log_check: Using $lf_path as logfile" | ||
| 82 | |||
| 83 | if test -e "$lf_path" | ||
| 84 | then | ||
| 85 | rootfs_${IMAGE_PKGTYPE}_log_check $target $lf_path | ||
| 86 | else | ||
| 87 | echo "Cannot find logfile [$lf_path]" | ||
| 88 | fi | ||
| 89 | echo "Logfile is clean" | ||
| 90 | done | ||
| 91 | |||
| 92 | set -x | ||
| 93 | } | ||
| 94 | |||
| 95 | # set '*' as the rootpassword so the images | ||
| 96 | # can decide if they want it or not | ||
| 97 | |||
| 98 | zap_root_password () { | ||
| 99 | sed 's%^root:[^:]*:%root:*:%' < ${IMAGE_ROOTFS}/etc/passwd >${IMAGE_ROOTFS}/etc/passwd.new | ||
| 100 | mv ${IMAGE_ROOTFS}/etc/passwd.new ${IMAGE_ROOTFS}/etc/passwd | ||
| 101 | } | ||
| 102 | |||
| 103 | create_etc_timestamp() { | ||
| 104 | date +%2m%2d%2H%2M%Y >${IMAGE_ROOTFS}/etc/timestamp | ||
| 105 | } | ||
| 106 | |||
| 107 | # Turn any symbolic /sbin/init link into a file | ||
| 108 | remove_init_link () { | ||
| 109 | if [ -h ${IMAGE_ROOTFS}/sbin/init ]; then | ||
| 110 | LINKFILE=${IMAGE_ROOTFS}`readlink ${IMAGE_ROOTFS}/sbin/init` | ||
| 111 | rm ${IMAGE_ROOTFS}/sbin/init | ||
| 112 | cp $LINKFILE ${IMAGE_ROOTFS}/sbin/init | ||
| 113 | fi | ||
| 114 | } | ||
| 115 | |||
| 116 | # export the zap_root_password, create_etc_timestamp and remote_init_link | ||
| 117 | EXPORT_FUNCTIONS zap_root_password create_etc_timestamp remove_init_link do_rootfs | ||
| 118 | |||
| 119 | addtask rootfs before do_build after do_install | ||
| 120 | |||
