diff options
author | Patrick Vacek <patrickvacek@gmail.com> | 2018-10-31 13:33:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-31 13:33:02 +0100 |
commit | 59cebd8d303a10fb0b0d6a345d07d85cf7d890e4 (patch) | |
tree | f359b071641c052e95fd582eb9ae36e7fcce5f9e /classes | |
parent | 0efe3823ea039213a1640d469d35d56fc68be60f (diff) | |
parent | e9c39a028894b8ed2a38a922d5f905a42985aeb4 (diff) | |
download | meta-updater-59cebd8d303a10fb0b0d6a345d07d85cf7d890e4.tar.gz |
Merge pull request #417 from advancedtelematic/feat/OTA-627/master/targetversion-forwardport
Feat/ota 627/master/targetversion forwardport
Diffstat (limited to 'classes')
-rw-r--r-- | classes/image_types_ostree.bbclass | 6 | ||||
-rw-r--r-- | classes/image_types_ota.bbclass | 2 | ||||
-rw-r--r-- | classes/target_version_example.bbclass | 10 |
3 files changed, 17 insertions, 1 deletions
diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass index 3bf2d0e..74282ef 100644 --- a/classes/image_types_ostree.bbclass +++ b/classes/image_types_ostree.bbclass | |||
@@ -193,7 +193,7 @@ IMAGE_CMD_ostreepush () { | |||
193 | } | 193 | } |
194 | 194 | ||
195 | IMAGE_TYPEDEP_garagesign = "ostreepush" | 195 | IMAGE_TYPEDEP_garagesign = "ostreepush" |
196 | do_image_garage_sign[depends] += "aktualizr-native:do_populate_sysroot" | 196 | do_image_garagesign[depends] += "aktualizr-native:do_populate_sysroot" |
197 | IMAGE_CMD_garagesign () { | 197 | IMAGE_CMD_garagesign () { |
198 | if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then | 198 | if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then |
199 | # if credentials are issued by a server that doesn't support offline signing, exit silently | 199 | # if credentials are issued by a server that doesn't support offline signing, exit silently |
@@ -219,6 +219,10 @@ IMAGE_CMD_garagesign () { | |||
219 | target_version=${ostree_target_hash} | 219 | target_version=${ostree_target_hash} |
220 | if [ -n "${GARAGE_TARGET_VERSION}" ]; then | 220 | if [ -n "${GARAGE_TARGET_VERSION}" ]; then |
221 | target_version=${GARAGE_TARGET_VERSION} | 221 | target_version=${GARAGE_TARGET_VERSION} |
222 | bbwarn "Target version is overriden with GARAGE_TARGET_VERSION variable. It is a dangerous operation, make sure you've read the respective secion in meta-updater/README.adoc" | ||
223 | elif [ -e "${STAGING_DATADIR_NATIVE}/target_version" ]; then | ||
224 | target_version=$(cat "${STAGING_DATADIR_NATIVE}/target_version") | ||
225 | bbwarn "Target version is overriden with target_version file. It is a dangerous operation, make sure you've read the respective secion in meta-updater/README.adoc" | ||
222 | fi | 226 | fi |
223 | 227 | ||
224 | # Push may fail due to race condition when multiple build machines try to push simultaneously | 228 | # Push may fail due to race condition when multiple build machines try to push simultaneously |
diff --git a/classes/image_types_ota.bbclass b/classes/image_types_ota.bbclass index ed1d579..03fe8d8 100644 --- a/classes/image_types_ota.bbclass +++ b/classes/image_types_ota.bbclass | |||
@@ -115,6 +115,8 @@ fakeroot do_otasetup () { | |||
115 | target_version=${ostree_target_hash} | 115 | target_version=${ostree_target_hash} |
116 | if [ -n "${GARAGE_TARGET_VERSION}" ]; then | 116 | if [ -n "${GARAGE_TARGET_VERSION}" ]; then |
117 | target_version=${GARAGE_TARGET_VERSION} | 117 | target_version=${GARAGE_TARGET_VERSION} |
118 | elif [ -e "${STAGING_DATADIR_NATIVE}/target_version" ]; then | ||
119 | target_version=$(cat "${STAGING_DATADIR_NATIVE}/target_version") | ||
118 | fi | 120 | fi |
119 | mkdir -p ${OTA_SYSROOT}/ostree/deploy/${OSTREE_OSNAME}/var/sota/import | 121 | mkdir -p ${OTA_SYSROOT}/ostree/deploy/${OSTREE_OSNAME}/var/sota/import |
120 | echo "{\"${ostree_target_hash}\":\"${GARAGE_TARGET_NAME}-${target_version}\"}" > ${OTA_SYSROOT}/ostree/deploy/${OSTREE_OSNAME}/var/sota/import/installed_versions | 122 | echo "{\"${ostree_target_hash}\":\"${GARAGE_TARGET_NAME}-${target_version}\"}" > ${OTA_SYSROOT}/ostree/deploy/${OSTREE_OSNAME}/var/sota/import/installed_versions |
diff --git a/classes/target_version_example.bbclass b/classes/target_version_example.bbclass new file mode 100644 index 0000000..ef119fb --- /dev/null +++ b/classes/target_version_example.bbclass | |||
@@ -0,0 +1,10 @@ | |||
1 | # Writes target version to be used by garage-sign | ||
2 | |||
3 | HOSTTOOLS += " git " | ||
4 | |||
5 | deploy_target_version () { | ||
6 | version=$(git --git-dir=${METADIR}/.repo/manifests/.git/ rev-parse HEAD) | ||
7 | echo -n ${version} > ${STAGING_DATADIR_NATIVE}/target_version | ||
8 | } | ||
9 | |||
10 | IMAGE_PREPROCESS_COMMAND += "deploy_target_version;" | ||