blob: f9f9f13c98d81b5726c920b8e011be2811c49396 [file] [log] [blame]
Jan Kundrát7a9d8b02020-02-05 23:03:00 +01001#!/bin/bash
2
3function czechlight_describe_git {
4 echo $(git --git-dir=${1}/.git --work-tree=${1} describe --dirty 2>/dev/null || git --git-dir=${1}/.git rev-parse --short HEAD)
5}
6
7function czechlight_query_local_make_var {
8 echo $(sed -n -e "s/\\s*$1\\s*=\\s*\\(.*\\)/\\1/p" ${BASE_DIR}/local.mk)
9}
10
11CLA_BR2_EXTERNAL_REV=$(czechlight_describe_git ${BR2_EXTERNAL_CZECHLIGHT_PATH})
12CLA_SYSREPO_REV=$(czechlight_describe_git $(czechlight_query_local_make_var CLA_SYSREPO_OVERRIDE_SRCDIR))
13NETCONF_CLI_REV=$(czechlight_describe_git $(czechlight_query_local_make_var NETCONF_CLI_OVERRIDE_SRCDIR))
14CLA_CPP_DEPENDENCIES_REV=$(czechlight_describe_git $(czechlight_query_local_make_var CLA_SYSREPO_OVERRIDE_SRCDIR)/submodules/dependencies)
Jan Kundrát18fb83e2021-03-01 22:35:50 +010015GAMMARUS_REV=$(czechlight_describe_git $(czechlight_query_local_make_var GAMMARUS_OVERRIDE_SRCDIR))
16VELIA_REV=$(czechlight_describe_git $(czechlight_query_local_make_var VELIA_OVERRIDE_SRCDIR))
Jan Kundrát02cbb812021-03-02 10:13:35 +010017ROUSETTE_REV=$(czechlight_describe_git $(czechlight_query_local_make_var VELIA_OVERRIDE_SRCDIR))
Jan Kundrát7a9d8b02020-02-05 23:03:00 +010018
19sed -i \
20 -e 's/^VERSION_ID=/BUILDROOT_VERSION_ID=/' \
21 -e 's/^VERSION=/BUILDROOT_VERSION=/' \
22 -e '/^NAME=/d' -e '/^PRETTY_NAME=/d' \
23 $TARGET_DIR/etc/os-release
24
25cat >> ${TARGET_DIR}/etc/os-release <<EOF
26NAME=CzechLight
27# When building under CI, these git revisions might not necessarily refer to
28# something that is available from Gerrit's git repositories. If the job which
29# produced this image is a result of a Zuul job tree with speculatively merged
30# changes, then these refs are private to Zuul mergers.
31PRETTY_NAME="Czech Light ${CLA_BR2_EXTERNAL_REV}"
32VERSION=${CLA_BR2_EXTERNAL_REV}
33CLA_SYSREPO_VERSION=${CLA_SYSREPO_REV}
34NETCONF_CLI_VERSION=${NETCONF_CLI_REV}
35CPP_DEPENDENCIES_VERSION=${CLA_CPP_DEPENDENCIES_REV}
Jan Kundrát0c418dc2020-03-09 19:41:29 -070036GAMMARUS_VERSION=${GAMMARUS_REV}
Jan Kundrát02cbb812021-03-02 10:13:35 +010037ROUSETTE_VERSION=${ROUSETTE_REV}
Jan Kundrát7a9d8b02020-02-05 23:03:00 +010038EOF