diff options
Diffstat (limited to 'classes/override_image_types_ostree.inc')
-rw-r--r-- | classes/override_image_types_ostree.inc | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/classes/override_image_types_ostree.inc b/classes/override_image_types_ostree.inc index ac584e5..241afcd 100644 --- a/classes/override_image_types_ostree.inc +++ b/classes/override_image_types_ostree.inc | |||
@@ -1,3 +1,18 @@ | |||
1 | # overrides meta-updater/classes/image_types_ostree.bbclass | ||
2 | # - add do_image_ostree flags: | ||
3 | # - dirs, cleandirs: to avoid mktemp, rm, cd, and to also remove at clean | ||
4 | # - subimages, imgsuffix: to use automatic link creation | ||
5 | # - override of IMAGE_CMD_ostree | ||
6 | # - use the added flags | ||
7 | # - IMGDEPLOYDIR, instead of DEPLOY_DIR_IMAGE | ||
8 | |||
9 | OSTREE_ROOTFS="${WORKDIR}/ostree-root" | ||
10 | do_image_ostree[dirs] = "${OSTREE_ROOTFS}" | ||
11 | do_image_ostree[cleandirs] = "${OSTREE_ROOTFS}" | ||
12 | do_image_ostree[subimages] = "rootfs.ostree.tar.bz2" | ||
13 | do_image_ostree[imgsuffix] = "." | ||
14 | export OSTREE_ROOTFS | ||
15 | |||
1 | IMAGE_CMD_ostree () { | 16 | IMAGE_CMD_ostree () { |
2 | if [ -z "$OSTREE_REPO" ]; then | 17 | if [ -z "$OSTREE_REPO" ]; then |
3 | bbfatal "OSTREE_REPO should be set in your local.conf" | 18 | bbfatal "OSTREE_REPO should be set in your local.conf" |
@@ -7,13 +22,10 @@ IMAGE_CMD_ostree () { | |||
7 | bbfatal "OSTREE_BRANCHNAME should be set in your local.conf" | 22 | bbfatal "OSTREE_BRANCHNAME should be set in your local.conf" |
8 | fi | 23 | fi |
9 | 24 | ||
10 | OSTREE_ROOTFS=`mktemp -du ${WORKDIR}/ostree-root-XXXXX` | 25 | cp -a ${IMAGE_ROOTFS}/* ${OSTREE_ROOTFS} |
11 | cp -a ${IMAGE_ROOTFS} ${OSTREE_ROOTFS} | ||
12 | chmod a+rx ${OSTREE_ROOTFS} | 26 | chmod a+rx ${OSTREE_ROOTFS} |
13 | sync | 27 | sync |
14 | 28 | ||
15 | cd ${OSTREE_ROOTFS} | ||
16 | |||
17 | for d in var/*; do | 29 | for d in var/*; do |
18 | if [ "${d}" != "var/local" ]; then | 30 | if [ "${d}" != "var/local" ]; then |
19 | rm -rf ${d} | 31 | rm -rf ${d} |
@@ -125,16 +137,11 @@ IMAGE_CMD_ostree () { | |||
125 | # Copy image manifest | 137 | # Copy image manifest |
126 | cat ${IMAGE_MANIFEST} | cut -d " " -f1,3 > usr/package.manifest | 138 | cat ${IMAGE_MANIFEST} | cut -d " " -f1,3 > usr/package.manifest |
127 | 139 | ||
128 | cd ${WORKDIR} | ||
129 | |||
130 | # Create a tarball that can be then commited to OSTree repo | 140 | # Create a tarball that can be then commited to OSTree repo |
131 | OSTREE_TAR=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ostree.tar.bz2 | 141 | OSTREE_TAR=${IMGDEPLOYDIR}/${IMAGE_NAME}.rootfs.ostree.tar.bz2 |
132 | tar -C ${OSTREE_ROOTFS} --xattrs --xattrs-include='*' -cjf ${OSTREE_TAR} . | 142 | tar -C ${OSTREE_ROOTFS} --xattrs --xattrs-include='*' -cjf ${OSTREE_TAR} . |
133 | sync | 143 | sync |
134 | 144 | ||
135 | rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.rootfs.ostree.tar.bz2 | ||
136 | ln -s ${IMAGE_NAME}.rootfs.ostree.tar.bz2 ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.rootfs.ostree.tar.bz2 | ||
137 | |||
138 | if ! ostree --repo=${OSTREE_REPO} refs 2>&1 > /dev/null; then | 145 | if ! ostree --repo=${OSTREE_REPO} refs 2>&1 > /dev/null; then |
139 | ostree --repo=${OSTREE_REPO} init --mode=archive-z2 | 146 | ostree --repo=${OSTREE_REPO} init --mode=archive-z2 |
140 | fi | 147 | fi |
@@ -145,6 +152,4 @@ IMAGE_CMD_ostree () { | |||
145 | --skip-if-unchanged \ | 152 | --skip-if-unchanged \ |
146 | --branch=${OSTREE_BRANCHNAME} \ | 153 | --branch=${OSTREE_BRANCHNAME} \ |
147 | --subject="Commit-id: ${IMAGE_NAME}" | 154 | --subject="Commit-id: ${IMAGE_NAME}" |
148 | |||
149 | rm -rf ${OSTREE_ROOTFS} | ||
150 | } | 155 | } |