#!/bin/bash # Copyright (c) 2011 The Chromium OS 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 to set /etc/lsb-release on the root file system. This script is run by # build_image inside chroot. SCRIPT_ROOT=$(readlink -f $(dirname "$0")/..) . "${SCRIPT_ROOT}/common.sh" || exit 1 PRODUCTION_DEFAULT= if [[ "${COREOS_OFFICIAL:-0}" -eq 1 ]]; then PRODUCTION_DEFAULT="dev-channel" fi # Flags DEFINE_string board "" "The board to build an image for." DEFINE_string root "" "The root file system to write /etc/lsb-release to." DEFINE_string production_track "${PRODUCTION_DEFAULT}" \ "Use production values and a given track for update service." # Parse command line FLAGS "$@" || exit 1 eval set -- "${FLAGS_ARGV}" switch_to_strict_mode ROOT_FS_DIR="$FLAGS_root" [ -n "$ROOT_FS_DIR" ] || die "--root is required." [ -d "$ROOT_FS_DIR" ] || die "Root FS does not exist? ($ROOT_FS_DIR)" COREOS_VERSION_NAME="CoreOS" if [[ -n "${FLAGS_production_track}" ]]; then COREOS_VERSION_TRACK="${FLAGS_production_track}" COREOS_VERSION_DESCRIPTION="${COREOS_VERSION_STRING} (Official Build) \ ${COREOS_VERSION_TRACK} $FLAGS_board test" if [[ "${FLAGS_production_track}" != "sdk" ]]; then COREOS_VERSION_AUSERVER="https://api.core-os.net/v1/update/" else COREOS_VERSION_AUSERVER="" fi COREOS_VERSION_DEVSERVER="" else # Developer hand-builds COREOS_VERSION_TRACK=${COREOS_VERSION_TRACK:-"developer-build"} COREOS_VERSION_DESCRIPTION="${COREOS_VERSION_STRING} (Developer Build \ - $USER) ${COREOS_VERSION_TRACK} $FLAGS_board" : ${COREOS_VERSION_AUSERVER:="http://$(hostname --fqdn):8080/update"} : ${COREOS_VERSION_DEVSERVER:="http://$(hostname --fqdn):8080"} fi # TODO(marineam): come up with a way to support continous integration builds, # this would provide all the bells and whistles for 'master' branch images. #elif [ "$USER" = "chrome-bot" ]; then # # Continuous builder # COREOS_VERSION_TRACK="buildbot-build" # COREOS_VERSION_DESCRIPTION="${COREOS_VERSION_STRING} (Continuous Build \ #- Builder: ${BUILDBOT_BUILD:-"N/A"}) $FLAGS_board" # Set coreos-specific version numbers: # COREOS_RELEASE_BOARD is the target board identifier. # COREOS_RELEASE_DESCRIPTION is the extended human readable form. # COREOS_RELEASE_NAME is a human readable name for the build. # COREOS_RELEASE_TRACK and COREOS_RELEASE_VERSION are used by the software # update service. # DISTRIB_* are the standard names for the same values. sudo mkdir -p "${ROOT_FS_DIR}/etc" sudo_clobber "${ROOT_FS_DIR}/etc/lsb-release" <