mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-22 06:01:41 +02:00
build_image: fix generation of version.txt
The generation of version.txt was the only thing depending on sourcing the deprecated BUILD, BRANCH, and PATCH values from version.txt which common.sh no longer does since 0b6acf86. Derive them instead.
This commit is contained in:
parent
ec58813496
commit
f6064d52e8
@ -182,10 +182,11 @@ then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Write out a version.txt file, this will be used by image_to_vm.sh
|
# Write out a version.txt file, this will be used by image_to_vm.sh
|
||||||
|
split_ver "${COREOS_VERSION_ID}" SPLIT
|
||||||
tee "${BUILD_DIR}/version.txt" <<EOF
|
tee "${BUILD_DIR}/version.txt" <<EOF
|
||||||
COREOS_BUILD=${COREOS_BUILD}
|
COREOS_BUILD=${SPLIT[0]}
|
||||||
COREOS_BRANCH=${COREOS_BRANCH}
|
COREOS_BRANCH=${SPLIT[1]}
|
||||||
COREOS_PATCH=${COREOS_PATCH}
|
COREOS_PATCH=${SPLIT[2]}
|
||||||
COREOS_VERSION=${COREOS_VERSION_STRING}
|
COREOS_VERSION=${COREOS_VERSION_STRING}
|
||||||
COREOS_VERSION_ID=${COREOS_VERSION_ID}
|
COREOS_VERSION_ID=${COREOS_VERSION_ID}
|
||||||
COREOS_BUILD_ID="${COREOS_BUILD_ID}"
|
COREOS_BUILD_ID="${COREOS_BUILD_ID}"
|
||||||
|
14
common.sh
14
common.sh
@ -172,6 +172,20 @@ cmp_ver() {
|
|||||||
return $?
|
return $?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Split a semver into a 3 item array (major minor patch)
|
||||||
|
# Usage: split_ver 1.2.3 NAME
|
||||||
|
split_ver() {
|
||||||
|
local v="$1" n="$2"
|
||||||
|
v="${v%%-*}" # strip off pre-release suffix
|
||||||
|
v="${v%%+*}" # strip off build id suffix
|
||||||
|
v="${v//./ }"
|
||||||
|
local -a a="(${v})"
|
||||||
|
if [[ ${#a[@]} -ne 3 ]]; then
|
||||||
|
die "Invalid version string '$1'"
|
||||||
|
fi
|
||||||
|
declare -g -a ${n}="(${v})"
|
||||||
|
}
|
||||||
|
|
||||||
# repo source root inside the chroot, usually mounted from the outside.
|
# repo source root inside the chroot, usually mounted from the outside.
|
||||||
CHROOT_TRUNK_DIR="/mnt/host/source"
|
CHROOT_TRUNK_DIR="/mnt/host/source"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user