diff options
| author | OYTIS <tossel@gmail.com> | 2017-08-10 11:37:09 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-08-10 11:37:09 +0200 |
| commit | cae622f61dae32ba5d4e96678e173afbe3637f9f (patch) | |
| tree | 70c72493a81bc9a15d0433b85bc81b8bee613271 /classes | |
| parent | 34d5f757a86a7e8e1db3e19f2fb33e90e3f33584 (diff) | |
| parent | e59b7e959695a31b109b873e7de420cf947e22b8 (diff) | |
| download | meta-updater-cae622f61dae32ba5d4e96678e173afbe3637f9f.tar.gz | |
Merge pull request #110 from advancedtelematic/bugfix/PRO-3484/avoid-build-unzip
Bugfix/pro 3484/avoid build unzip
Diffstat (limited to 'classes')
| -rw-r--r-- | classes/image_types_ostree.bbclass | 59 |
1 files changed, 16 insertions, 43 deletions
diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass index ac7cb60..d01cb9f 100644 --- a/classes/image_types_ostree.bbclass +++ b/classes/image_types_ostree.bbclass | |||
| @@ -17,36 +17,6 @@ OSTREE_KERNEL ??= "${KERNEL_IMAGETYPE}" | |||
| 17 | 17 | ||
| 18 | export SYSTEMD_USED = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', '', d)}" | 18 | export SYSTEMD_USED = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', '', d)}" |
| 19 | 19 | ||
| 20 | python () { | ||
| 21 | if d.getVar("SOTA_PACKED_CREDENTIALS", True): | ||
| 22 | if d.getVar("SOTA_AUTOPROVISION_CREDENTIALS", True): | ||
| 23 | bb.warn("SOTA_AUTOPROVISION_CREDENTIALS are overriden by those in SOTA_PACKED_CREDENTIALS") | ||
| 24 | if d.getVar("SOTA_AUTOPROVISION_URL", True): | ||
| 25 | bb.warn("SOTA_AUTOPROVISION_URL is overriden by the one in SOTA_PACKED_CREDENTIALS") | ||
| 26 | |||
| 27 | if d.getVar("SOTA_AUTOPROVISION_URL_FILE", True): | ||
| 28 | bb.warn("SOTA_AUTOPROVISION_URL_FILE is overriden by the one in SOTA_PACKED_CREDENTIALS") | ||
| 29 | |||
| 30 | if d.getVar("OSTREE_PUSH_CREDENTIALS", True): | ||
| 31 | bb.warn("OSTREE_PUSH_CREDENTIALS are overriden by those in SOTA_PACKED_CREDENTIALS") | ||
| 32 | |||
| 33 | d.setVar("SOTA_AUTOPROVISION_CREDENTIALS", "%s/sota_credentials/autoprov_credentials.p12" % d.getVar("DEPLOY_DIR_IMAGE", True)) | ||
| 34 | d.setVar("SOTA_AUTOPROVISION_URL_FILE", "%s/sota_credentials/autoprov.url" % d.getVar("DEPLOY_DIR_IMAGE", True)) | ||
| 35 | d.setVar("OSTREE_PUSH_CREDENTIALS", "%s/sota_credentials/treehub.json" % d.getVar("DEPLOY_DIR_IMAGE", True)) | ||
| 36 | } | ||
| 37 | |||
| 38 | IMAGE_DEPENDS_ostreecredunpack = "unzip-native:do_populate_sysroot" | ||
| 39 | |||
| 40 | IMAGE_CMD_ostreecredunpack () { | ||
| 41 | if [ ${SOTA_PACKED_CREDENTIALS} ]; then | ||
| 42 | rm -rf ${DEPLOY_DIR_IMAGE}/sota_credentials | ||
| 43 | |||
| 44 | unzip ${SOTA_PACKED_CREDENTIALS} -d ${DEPLOY_DIR_IMAGE}/sota_credentials | ||
| 45 | fi | ||
| 46 | } | ||
| 47 | |||
| 48 | IMAGE_TYPEDEP_ostree = "ostreecredunpack" | ||
| 49 | |||
| 50 | IMAGE_CMD_ostree () { | 20 | IMAGE_CMD_ostree () { |
| 51 | if [ -z "$OSTREE_REPO" ]; then | 21 | if [ -z "$OSTREE_REPO" ]; then |
| 52 | bbfatal "OSTREE_REPO should be set in your local.conf" | 22 | bbfatal "OSTREE_REPO should be set in your local.conf" |
| @@ -145,21 +115,24 @@ IMAGE_CMD_ostree () { | |||
| 145 | ln -sf var/roothome root | 115 | ln -sf var/roothome root |
| 146 | fi | 116 | fi |
| 147 | 117 | ||
| 148 | # deploy SOTA credentials | ||
| 149 | mkdir -p var/sota | 118 | mkdir -p var/sota |
| 150 | 119 | ||
| 151 | if [ -n "${SOTA_AUTOPROVISION_CREDENTIALS}" ]; then | 120 | if [ -n "${SOTA_AUTOPROVISION_CREDENTIALS}" ]; then |
| 152 | EXPDATE=`openssl pkcs12 -in ${SOTA_AUTOPROVISION_CREDENTIALS} -password "pass:" -nodes 2>/dev/null | openssl x509 -noout -enddate | cut -f2 -d "="` | 121 | bbwarn "SOTA_AUTOPROVISION_CREDENTIALS are ignored. Please use SOTA_PACKED_CREDENTIALS" |
| 153 | 122 | fi | |
| 154 | if [ `date +%s` -ge `date -d "${EXPDATE}" +%s` ]; then | 123 | if [ -n "${SOTA_AUTOPROVISION_URL}" ]; then |
| 155 | bberror "Certificate ${SOTA_AUTOPROVISION_CREDENTIALS} has expired on ${EXPDATE}" | 124 | bbwarn "SOTA_AUTOPROVISION_URL is ignored. Please use SOTA_PACKED_CREDENTIALS" |
| 156 | fi | 125 | fi |
| 126 | if [ -n "${SOTA_AUTOPROVISION_URL_FILE}" ]; then | ||
| 127 | bbwarn "SOTA_AUTOPROVISION_URL_FILE is ignored. Please use SOTA_PACKED_CREDENTIALS" | ||
| 128 | fi | ||
| 129 | if [ -n "${OSTREE_PUSH_CREDENTIALS}" ]; then | ||
| 130 | bbwarn "OSTREE_PUSH_CREDENTIALS is ignored. Please use SOTA_PACKED_CREDENTIALS" | ||
| 131 | fi | ||
| 157 | 132 | ||
| 158 | cp ${SOTA_AUTOPROVISION_CREDENTIALS} var/sota/sota_provisioning_credentials.p12 | 133 | # deploy SOTA credentials |
| 159 | if [ -n "${SOTA_AUTOPROVISION_URL_FILE}" ]; then | 134 | if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then |
| 160 | export SOTA_AUTOPROVISION_URL=`cat ${SOTA_AUTOPROVISION_URL_FILE}` | 135 | cp ${SOTA_PACKED_CREDENTIALS} var/sota/sota_provisioning_credentials.zip |
| 161 | fi | ||
| 162 | echo "SOTA_GATEWAY_URI=${SOTA_AUTOPROVISION_URL}" > var/sota/sota_provisioning_url.env | ||
| 163 | fi | 136 | fi |
| 164 | 137 | ||
| 165 | if [ -n "${SOTA_SECONDARY_ECUS}" ]; then | 138 | if [ -n "${SOTA_SECONDARY_ECUS}" ]; then |
| @@ -207,10 +180,10 @@ IMAGE_CMD_ostree () { | |||
| 207 | IMAGE_TYPEDEP_ostreepush = "ostree" | 180 | IMAGE_TYPEDEP_ostreepush = "ostree" |
| 208 | IMAGE_DEPENDS_ostreepush = "sota-tools-native:do_populate_sysroot" | 181 | IMAGE_DEPENDS_ostreepush = "sota-tools-native:do_populate_sysroot" |
| 209 | IMAGE_CMD_ostreepush () { | 182 | IMAGE_CMD_ostreepush () { |
| 210 | if [ -n "${OSTREE_PUSH_CREDENTIALS}" ]; then | 183 | if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then |
| 211 | garage-push --repo=${OSTREE_REPO} \ | 184 | garage-push --repo=${OSTREE_REPO} \ |
| 212 | --ref=${OSTREE_BRANCHNAME} \ | 185 | --ref=${OSTREE_BRANCHNAME} \ |
| 213 | --credentials=${OSTREE_PUSH_CREDENTIALS} \ | 186 | --credentials=${SOTA_PACKED_CREDENTIALS} \ |
| 214 | --cacert=${STAGING_ETCDIR_NATIVE}/ssl/certs/ca-certificates.crt | 187 | --cacert=${STAGING_ETCDIR_NATIVE}/ssl/certs/ca-certificates.crt |
| 215 | fi | 188 | fi |
| 216 | } | 189 | } |
