Chris Sosa | 7e81258 | 2014-03-06 15:22:10 -0800 | [diff] [blame] | 1 | # Copyright (c) 2014 The Chromium OS Authors. All rights reserved. |
| 2 | # Use of this source code is governed by a BSD-style license that can be |
| 3 | # found in the LICENSE file. |
| 4 | # $Header: $ |
| 5 | |
| 6 | # @ECLASS: hwid.eclass |
| 7 | # @MAINTAINER: |
| 8 | # Chromium OS Brillo team |
| 9 | # @BUGREPORTS: |
| 10 | # Please report bugs via http://crbug.com/new (with label Build) |
| 11 | # @VCSURL: https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/master/eclass/@ECLASS@ |
| 12 | # @BLURB: Eclass for setting up HWID_OVERRIDE in /etc/lsb-release |
| 13 | # |
| 14 | # @FUNCTION: dohwid |
| 15 | # @USAGE: <hwid> |
| 16 | # @DESCRIPTION: |
| 17 | # Appends hwid to /etc/lsb-release. |
| 18 | # The inputs are not currently restricted in any way though most look like: |
| 19 | # ^BOARD .* . |
| 20 | # Additional note, this must be run after doappid in the chromeos-bsp file. |
| 21 | # @CODE |
| 22 | # dohwid "TACO ALPHA 1" |
| 23 | # @CODE |
| 24 | # will append |
| 25 | # @CODE |
| 26 | # HWID_OVERRIDE=TACO ALPHA 1 |
| 27 | # @CODE |
| 28 | # to /etc/lsb-release. |
| 29 | dohwid() { |
| 30 | [[ $# -eq 1 && -n $1 ]] || die "Usage: ${FUNCNAME} <hwid>" |
| 31 | local hwid="$1" |
| 32 | |
| 33 | # Actually check if we'll use the hwid_override. |
| 34 | if ! use hwid_override ; then |
| 35 | die "hwid_override not set" |
| 36 | fi |
| 37 | |
| 38 | dodir /etc |
| 39 | local lsb="${D}/etc/lsb-release" |
| 40 | [[ ! -e "${lsb}" ]] && die "/etc/lsb file missing. Run doappid first." |
| 41 | cat <<-EOF >> "${lsb}" |
| 42 | HWID_OVERRIDE=${hwid} |
| 43 | EOF |
| 44 | } |