diff options
author | Anton Gerasimov <anton.gerasimov@here.com> | 2018-09-04 16:56:01 +0200 |
---|---|---|
committer | Anton Gerasimov <anton.gerasimov@here.com> | 2018-09-04 16:56:01 +0200 |
commit | 2db3eed2699c9e8b147926480a6b9fe00a36a4c6 (patch) | |
tree | dbe6a7abda40785b77435410da62c33cd9ea32d3 | |
parent | a2bb8a02a982e6fdbcd272af984da90807399be9 (diff) | |
download | meta-updater-2db3eed2699c9e8b147926480a6b9fe00a36a4c6.tar.gz |
Provide example for setting UPTANE target version automaticallyfeat/targetversion
-rw-r--r-- | classes/image_types_ostree.bbclass | 4 | ||||
-rw-r--r-- | classes/target_version_example.bbclass | 11 |
2 files changed, 14 insertions, 1 deletions
diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass index bc44e33..1ac848d 100644 --- a/classes/image_types_ostree.bbclass +++ b/classes/image_types_ostree.bbclass | |||
@@ -178,7 +178,7 @@ IMAGE_CMD_ostreepush () { | |||
178 | } | 178 | } |
179 | 179 | ||
180 | IMAGE_TYPEDEP_garagesign = "ostreepush" | 180 | IMAGE_TYPEDEP_garagesign = "ostreepush" |
181 | do_image_garage_sign[depends] += "aktualizr-native:do_populate_sysroot" | 181 | do_image_garagesign[depends] += "aktualizr-native:do_populate_sysroot" |
182 | IMAGE_CMD_garagesign () { | 182 | IMAGE_CMD_garagesign () { |
183 | if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then | 183 | if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then |
184 | # if credentials are issued by a server that doesn't support offline signing, exit silently | 184 | # if credentials are issued by a server that doesn't support offline signing, exit silently |
@@ -204,6 +204,8 @@ IMAGE_CMD_garagesign () { | |||
204 | target_version=${ostree_target_hash} | 204 | target_version=${ostree_target_hash} |
205 | if [ -n "${GARAGE_TARGET_VERSION}" ]; then | 205 | if [ -n "${GARAGE_TARGET_VERSION}" ]; then |
206 | target_version=${GARAGE_TARGET_VERSION} | 206 | target_version=${GARAGE_TARGET_VERSION} |
207 | elif [ -e "${STAGING_DATADIR_NATIVE}/target_version" ]; then | ||
208 | target_version=$(cat "${STAGING_DATADIR_NATIVE}/target_version") | ||
207 | fi | 209 | fi |
208 | 210 | ||
209 | # Push may fail due to race condition when multiple build machines try to push simultaneously | 211 | # Push may fail due to race condition when multiple build machines try to push simultaneously |
diff --git a/classes/target_version_example.bbclass b/classes/target_version_example.bbclass new file mode 100644 index 0000000..5adf159 --- /dev/null +++ b/classes/target_version_example.bbclass | |||
@@ -0,0 +1,11 @@ | |||
1 | # Writes uses repo manifest version as a target version | ||
2 | # | ||
3 | |||
4 | HOSTTOOLS += " git " | ||
5 | |||
6 | deploy_target_version () { | ||
7 | version=$(git --git-dir=${METADIR}/.repo/manifests/.git/ rev-parse HEAD) | ||
8 | echo -n ${version} > ${STAGING_DATADIR_NATIVE}/target_version | ||
9 | } | ||
10 | |||
11 | IMAGE_PREPROCESS_COMMAND += "deploy_target_version;" | ||