mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-23 22:51:03 +02:00
Merge pull request #159 from flatcar-linux/t-lo/use-new-bincache-mirror
setup_board, update_chroot, dev container: use new bincache mirror
This commit is contained in:
commit
7f80cb138b
@ -18,6 +18,7 @@ assert_inside_chroot
|
|||||||
assert_not_root_user
|
assert_not_root_user
|
||||||
|
|
||||||
DEFAULT_GROUP=developer
|
DEFAULT_GROUP=developer
|
||||||
|
DEFAULT_DEVCONTAINER_BINHOST="https://mirror.release.flatcar-linux.net"
|
||||||
|
|
||||||
# Developer-visible flags.
|
# Developer-visible flags.
|
||||||
DEFINE_string board "${DEFAULT_BOARD}" \
|
DEFINE_string board "${DEFAULT_BOARD}" \
|
||||||
@ -48,6 +49,8 @@ DEFINE_boolean extract_update "${FLAGS_TRUE}" \
|
|||||||
"Extract the /usr partition for generating updates."
|
"Extract the /usr partition for generating updates."
|
||||||
DEFINE_string developer_data "" \
|
DEFINE_string developer_data "" \
|
||||||
"Insert a custom cloudinit file into the image."
|
"Insert a custom cloudinit file into the image."
|
||||||
|
DEFINE_string devcontainer_binhost "${DEFAULT_DEVCONTAINER_BINHOST}" \
|
||||||
|
"Override portage binhost configuration used in development container."
|
||||||
|
|
||||||
# include upload options
|
# include upload options
|
||||||
. "${BUILD_LIBRARY_DIR}/release_util.sh" || exit 1
|
. "${BUILD_LIBRARY_DIR}/release_util.sh" || exit 1
|
||||||
@ -167,7 +170,7 @@ fix_mtab
|
|||||||
|
|
||||||
if [[ "${CONTAINER}" -eq 1 ]]; then
|
if [[ "${CONTAINER}" -eq 1 ]]; then
|
||||||
IMAGE_BUILD_TYPE="container"
|
IMAGE_BUILD_TYPE="container"
|
||||||
create_dev_container "${FLATCAR_DEVELOPER_CONTAINER_NAME}" "${CONTAINER_LAYOUT}" "${FLAGS_group}" ${FLAGS_base_dev_pkg}
|
create_dev_container "${FLATCAR_DEVELOPER_CONTAINER_NAME}" "${CONTAINER_LAYOUT}" "${FLAGS_devcontainer_binhost}" "${FLAGS_group}" ${FLAGS_base_dev_pkg}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${PROD_IMAGE}" -eq 1 ]]; then
|
if [[ "${PROD_IMAGE}" -eq 1 ]]; then
|
||||||
|
@ -3,12 +3,13 @@
|
|||||||
# found in the LICENSE file.
|
# found in the LICENSE file.
|
||||||
|
|
||||||
get_binhost_url() {
|
get_binhost_url() {
|
||||||
local image_group=$1
|
local binhost_base=$1
|
||||||
local image_path=$2
|
local image_group=$2
|
||||||
|
local image_path=$3
|
||||||
if [ "${image_group}" == "developer" ]; then
|
if [ "${image_group}" == "developer" ]; then
|
||||||
echo "https://storage.googleapis.com/flatcar-jenkins/${image_group}/boards/${BOARD}/${FLATCAR_VERSION}/${image_path}"
|
echo "${binhost_base}/${image_group}/boards/${BOARD}/${FLATCAR_VERSION}/${image_path}"
|
||||||
else
|
else
|
||||||
echo "https://storage.googleapis.com/flatcar-jenkins/boards/${BOARD}/${FLATCAR_VERSION_ID}/${image_path}"
|
echo "${binhost_base}/boards/${BOARD}/${FLATCAR_VERSION_ID}/${image_path}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,8 +36,8 @@ PKGDIR="/var/lib/portage/pkgs"
|
|||||||
PORT_LOGDIR="/var/log/portage"
|
PORT_LOGDIR="/var/log/portage"
|
||||||
PORTDIR="/var/lib/portage/portage-stable"
|
PORTDIR="/var/lib/portage/portage-stable"
|
||||||
PORTDIR_OVERLAY="/var/lib/portage/coreos-overlay"
|
PORTDIR_OVERLAY="/var/lib/portage/coreos-overlay"
|
||||||
PORTAGE_BINHOST="$(get_binhost_url $2 'pkgs')
|
PORTAGE_BINHOST="$(get_binhost_url "$2" "$3" 'pkgs')
|
||||||
$(get_binhost_url $2 'toolchain')"
|
$(get_binhost_url "$2" "$3" 'toolchain')"
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
sudo_clobber "$1/etc/portage/repos.conf/coreos.conf" <<EOF
|
sudo_clobber "$1/etc/portage/repos.conf/coreos.conf" <<EOF
|
||||||
@ -67,8 +68,9 @@ EOF
|
|||||||
create_dev_container() {
|
create_dev_container() {
|
||||||
local image_name=$1
|
local image_name=$1
|
||||||
local disk_layout=$2
|
local disk_layout=$2
|
||||||
local update_group=$3
|
local binhost=$3
|
||||||
local base_pkg="$4"
|
local update_group=$4
|
||||||
|
local base_pkg="$5"
|
||||||
|
|
||||||
if [ -z "${base_pkg}" ]; then
|
if [ -z "${base_pkg}" ]; then
|
||||||
echo "did not get base package!"
|
echo "did not get base package!"
|
||||||
@ -92,7 +94,7 @@ create_dev_container() {
|
|||||||
insert_licenses "${BUILD_DIR}/${image_licenses}" "${root_fs_dir}"
|
insert_licenses "${BUILD_DIR}/${image_licenses}" "${root_fs_dir}"
|
||||||
|
|
||||||
# Setup portage for emerge and gmerge
|
# Setup portage for emerge and gmerge
|
||||||
configure_dev_portage "${root_fs_dir}" "${update_group}"
|
configure_dev_portage "${root_fs_dir}" "${binhost}" "${update_group}"
|
||||||
|
|
||||||
# Mark the image as a developer image (input to chromeos_startup).
|
# Mark the image as a developer image (input to chromeos_startup).
|
||||||
# TODO(arkaitzr): Remove this file when applications no longer rely on it
|
# TODO(arkaitzr): Remove this file when applications no longer rely on it
|
||||||
|
@ -337,7 +337,7 @@ readonly COREOS_EPOCH=1372636800
|
|||||||
TODAYS_VERSION=$(( (`date +%s` - ${COREOS_EPOCH}) / 86400 ))
|
TODAYS_VERSION=$(( (`date +%s` - ${COREOS_EPOCH}) / 86400 ))
|
||||||
|
|
||||||
# Download URL prefix for SDK and board binary packages
|
# Download URL prefix for SDK and board binary packages
|
||||||
: ${FLATCAR_DEV_BUILDS:=https://storage.googleapis.com/flatcar-jenkins}
|
: ${FLATCAR_DEV_BUILDS:=https://mirror.release.flatcar-linux.net}
|
||||||
|
|
||||||
# Load developer's custom settings. Default location is in scripts dir,
|
# Load developer's custom settings. Default location is in scripts dir,
|
||||||
# since that's available both inside and outside the chroot. By convention,
|
# since that's available both inside and outside the chroot. By convention,
|
||||||
|
22
set_version
22
set_version
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
DEFAULT_BASE_URL="https://storage.googleapis.com/flatcar-jenkins"
|
DEFAULT_BASE_URL="https://mirror.release.flatcar-linux.net"
|
||||||
DEV_BOARD_URL="${DEFAULT_BASE_URL}/developer"
|
DEV_BOARD_URL="${DEFAULT_BASE_URL}/developer"
|
||||||
DEFAULT_SDK_URL="${DEFAULT_BASE_URL}/sdk"
|
DEFAULT_SDK_URL="${DEFAULT_BASE_URL}/sdk"
|
||||||
DEV_SDK_URL="${DEFAULT_BASE_URL}/developer/sdk"
|
DEV_SDK_URL="${DEFAULT_BASE_URL}/developer/sdk"
|
||||||
@ -41,14 +41,34 @@ Usage: $0 FLAGS...
|
|||||||
--file FILE: Modify another file than ${FILE}, useful if run
|
--file FILE: Modify another file than ${FILE}, useful if run
|
||||||
outside of the SDK chroot. If /dev/stdout or
|
outside of the SDK chroot. If /dev/stdout or
|
||||||
/dev/stderr is used, only new values are printed.
|
/dev/stderr is used, only new values are printed.
|
||||||
|
--binhost Use a custom binhost (defaults to '${DEFAULT_BASE_URL}').
|
||||||
|
This will update BOARD and SDK URLs accordingly.
|
||||||
"
|
"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# --binhost needs to be evaluated first since it impacts other variables set below
|
||||||
|
custom_binhost="false"
|
||||||
|
for arg in "${@}" ; do
|
||||||
|
if $custom_binhost; then
|
||||||
|
echo "Using custom binhost '${arg}'"
|
||||||
|
DEFAULT_BASE_URL="${arg}"
|
||||||
|
DEV_BOARD_URL="${DEFAULT_BASE_URL}/developer"
|
||||||
|
DEFAULT_SDK_URL="${DEFAULT_BASE_URL}/sdk"
|
||||||
|
DEV_SDK_URL="${DEFAULT_BASE_URL}/developer/sdk"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
if [ "$arg" = "--binhost" ] ; then
|
||||||
|
custom_binhost="true"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
while [[ $# -gt 0 ]]; do
|
while [[ $# -gt 0 ]]; do
|
||||||
ARG="$1"
|
ARG="$1"
|
||||||
shift
|
shift
|
||||||
case "${ARG}" in
|
case "${ARG}" in
|
||||||
|
--binhost) # handled separately above, pass
|
||||||
|
shift;;
|
||||||
--board-version)
|
--board-version)
|
||||||
VAL="$1"
|
VAL="$1"
|
||||||
shift
|
shift
|
||||||
|
@ -28,7 +28,7 @@ DEFINE_boolean getbinpkg "${FLAGS_TRUE}" \
|
|||||||
DEFINE_string getbinpkgver "" \
|
DEFINE_string getbinpkgver "" \
|
||||||
"Use binary packages from a specific version."
|
"Use binary packages from a specific version."
|
||||||
DEFINE_string binhost "" \
|
DEFINE_string binhost "" \
|
||||||
"Use binary packages from a specific location (e.g. https://storage.googleapis.com/flatcar-jenkins/sdk/amd64/2000.0.0/pkgs)"
|
"Use binary packages from a specific location instead of $FLATCAR_DEV_BUILDS/... "
|
||||||
DEFINE_boolean toolchainpkgonly "${FLAGS_FALSE}" \
|
DEFINE_boolean toolchainpkgonly "${FLAGS_FALSE}" \
|
||||||
"Use binary packages only for the board toolchain."
|
"Use binary packages only for the board toolchain."
|
||||||
DEFINE_boolean skip_toolchain_update "${FLAGS_FALSE}" \
|
DEFINE_boolean skip_toolchain_update "${FLAGS_FALSE}" \
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
|
|
||||||
. "$(dirname "$0")/common.sh" || exit 1
|
. "$(dirname "$0")/common.sh" || exit 1
|
||||||
|
. "${BUILD_LIBRARY_DIR}/toolchain_util.sh"
|
||||||
|
|
||||||
# Script must run inside the chroot
|
# Script must run inside the chroot
|
||||||
assert_inside_chroot "$@"
|
assert_inside_chroot "$@"
|
||||||
@ -28,7 +29,7 @@ DEFINE_string toolchain_boards "" \
|
|||||||
DEFINE_string dev_builds_sdk "" \
|
DEFINE_string dev_builds_sdk "" \
|
||||||
"Set FLATCAR_DEV_BUILDS_SDK which defaults to FLATCAR_DEV_BUILDS/sdk"
|
"Set FLATCAR_DEV_BUILDS_SDK which defaults to FLATCAR_DEV_BUILDS/sdk"
|
||||||
DEFINE_string binhost "" \
|
DEFINE_string binhost "" \
|
||||||
"Use binary packages from a specific location (e.g. https://storage.googleapis.com/flatcar-jenkins/sdk/amd64/2000.0.0/pkgs)"
|
"Use binary packages from a specific location (like $(get_sdk_binhost | tr '\n' ' '}))"
|
||||||
|
|
||||||
FLAGS_HELP="usage: $(basename $0) [flags]
|
FLAGS_HELP="usage: $(basename $0) [flags]
|
||||||
Performs an update of the chroot. This script is called as part of
|
Performs an update of the chroot. This script is called as part of
|
||||||
@ -57,8 +58,6 @@ if [[ -n "${FLAGS_dev_builds_sdk}" ]]; then
|
|||||||
FLATCAR_DEV_BUILDS_SDK="${FLAGS_dev_builds_sdk}"
|
FLATCAR_DEV_BUILDS_SDK="${FLAGS_dev_builds_sdk}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
. "${BUILD_LIBRARY_DIR}/toolchain_util.sh"
|
|
||||||
|
|
||||||
PORTAGE_STABLE_OVERLAY="${REPO_ROOT}/src/third_party/portage-stable"
|
PORTAGE_STABLE_OVERLAY="${REPO_ROOT}/src/third_party/portage-stable"
|
||||||
CROSSDEV_OVERLAY="/usr/local/portage/crossdev"
|
CROSSDEV_OVERLAY="/usr/local/portage/crossdev"
|
||||||
COREOS_OVERLAY="${REPO_ROOT}/src/third_party/coreos-overlay"
|
COREOS_OVERLAY="${REPO_ROOT}/src/third_party/coreos-overlay"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user