forked from flatcar/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_toolchains
executable file
·57 lines (48 loc) · 1.71 KB
/
build_toolchains
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
#
# Copyright (c) 2013 The CoreOS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
. "${SCRIPT_ROOT}/common.sh" || exit 1
TYPE="coreos-toolchains"
FORCE_STAGES="stage4"
. "${BUILD_LIBRARY_DIR}/catalyst.sh" || exit 1
# include upload options
. "${BUILD_LIBRARY_DIR}/release_util.sh" || exit 1
## Define the stage4 config template
catalyst_stage4() {
cat <<EOF
pkgcache_path: $BINPKGS
stage4/packages: @system
stage4/fsscript: ${BUILD_LIBRARY_DIR}/catalyst_toolchains.sh
stage4/root_overlay: ${ROOT_OVERLAY}
EOF
catalyst_stage_default 4
}
create_provenance_overlay() {
local root_overlay="$1"
while read f; do
d="${f%/*}"
mkdir -p "${root_overlay}${d}/"
cp "${f}" "${root_overlay}${d}/"
done < <(find /mnt/host/source/src/scripts -name HEAD)
local scripts_git=/mnt/host/source/src/scripts/.git
# `git rev-parse` fails due to the safe.directory setting in SDK container.
# Open-code the ref lookup
read scripts_hash <"${scripts_git}/HEAD"
if [[ "${scripts_hash}" == "ref:"* ]]; then
read scripts_hash<"${scripts_git}/${scripts_hash#ref: }"
echo "${scripts_hash}" >"${root_overlay}${scripts_git}/HEAD"
fi
mkdir -p "${root_overlay}/mnt/host/source/.repo/manifests"
cp "${REPO_MANIFESTS_DIR}/version.txt" "${root_overlay}/mnt/host/source/.repo/manifests"
}
catalyst_init "$@"
ROOT_OVERLAY="${TEMPDIR}/stage4-${ARCH}-$FLAGS_version-overlay"
# toolchain_util.sh is required by catalyst_toolchains.sh
mkdir -p "${ROOT_OVERLAY}/tmp"
cp "${BUILD_LIBRARY_DIR}/toolchain_util.sh" "${ROOT_OVERLAY}/tmp"
create_provenance_overlay "${ROOT_OVERLAY}"
catalyst_build
command_completed