base-files: rework '/etc/os-release' file
* Do not hard-code the DISTRO* values and set them from the environment * Move the build information to a different file (following commit) Signed-off-by: Javier Viguera <javier.viguera@digi.com>
This commit is contained in:
parent
08589f8942
commit
2b7fb6b3cf
|
|
@ -1,11 +1,6 @@
|
|||
NAME="Digi Embedded Linux"
|
||||
VERSION="1.0.0 (for Danny)"
|
||||
ID=del
|
||||
NAME="##DISTRO_NAME##"
|
||||
VERSION="##DISTRO_VERSION##"
|
||||
ID=##DISTRO##
|
||||
ID_LIKE=yocto
|
||||
VERSION_ID="1.0.0"
|
||||
PRETTY_NAME="Digi Embedded Linux 1.0.0 (for Danny)"
|
||||
|
||||
BUILD CONFIGURATION
|
||||
===================
|
||||
BUILD_TIMESTAMP=##BUILD_TIMESTAMP##
|
||||
DEL_TAG=##DEL_TAG##
|
||||
VERSION_ID="##DISTRO_VERSION##"
|
||||
PRETTY_NAME="##DISTRO_NAME## ##DISTRO_VERSION##"
|
||||
|
|
|
|||
|
|
@ -6,29 +6,16 @@ PR_append = "+${DISTRO}"
|
|||
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
|
||||
|
||||
SRC_URI += " \
|
||||
file://os-release \
|
||||
file://sysctl.conf \
|
||||
file://os-release \
|
||||
file://sysctl.conf \
|
||||
"
|
||||
|
||||
TIMESTAMP = "${@time.strftime('%Y%m%d%H%M')}"
|
||||
LAYERS_REV = "${@"\nLayers revisions:\n%s\n" % '\n'.join(get_layers_branch_rev(d))}"
|
||||
DEL_TAG = "${@del_tag(d).strip()}"
|
||||
|
||||
def del_tag(d):
|
||||
import subprocess
|
||||
for layer in d.getVar('BBLAYERS', True).split():
|
||||
if 'meta-digi-del' in layer:
|
||||
cmd = 'git describe --tags --exact-match 2>/dev/null || true'
|
||||
return subprocess.Popen(cmd, cwd=layer, shell=True, stdout=subprocess.PIPE).stdout.read()
|
||||
return ""
|
||||
|
||||
do_install_append() {
|
||||
install -m 0644 ${WORKDIR}/os-release ${D}${sysconfdir}/
|
||||
sed -i -e 's,##DEL_TAG##,${DEL_TAG},g' ${D}${sysconfdir}/os-release
|
||||
sed -i -e 's,##BUILD_TIMESTAMP##,${TIMESTAMP},g' ${D}${sysconfdir}/os-release
|
||||
cat >> ${D}${sysconfdir}/os-release <<-EOF
|
||||
${LAYERS_REV}
|
||||
EOF
|
||||
sed -i -e 's,##DISTRO##,${DISTRO},g' \
|
||||
-e 's,##DISTRO_NAME##,${DISTRO_NAME},g' \
|
||||
-e 's,##DISTRO_VERSION##,${DISTRO_VERSION},g' \
|
||||
${D}${sysconfdir}/os-release
|
||||
install -m 0644 ${WORKDIR}/sysctl.conf ${D}${sysconfdir}/
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue