source: trunk/rules/get_config_target.sh @ 696

Last change on this file since 696 was 696, checked in by amain, 5 years ago

Relocate build/install dirs to prepare for building images for all targets

  • Property svn:executable set to *
File size: 1.5 KB
Line 
1#!/bin/bash
2#
3# DebWrt - Debian on Embedded devices
4#
5# Copyright (C) 2010, 2015 Johan van Zoomeren <amain@debwrt.net>
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation, either version 3 of the License, or
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
20TYPE=${1}
21CONFIG_FILE=${2}
22
23if [ ! -f "${CONFIG_FILE}" ]
24then
25    echo "Config file does not exists"
26    exit 1
27fi
28
29function get_config_value()
30{
31    local config=${1}
32
33    grep "^CONFIG_${config}=" ${CONFIG_FILE} \
34     | sed 's/CONFIG_.*=//' \
35     | tr -d '"'
36}
37
38
39function get_target()
40{
41    get_config_value TARGET_BOARD
42}
43
44function get_subtarget()
45{
46    local target=$(get_target)
47
48    grep "CONFIG_TARGET_${target}_[^_]\+=" ${CONFIG_FILE} \
49     | awk -F "[_=]" '{print $4}'
50}
51
52function get_profile()
53{
54    local target=$(get_target)
55
56    grep "CONFIG_TARGET_${target}_.*_.*\+=" ${CONFIG_FILE} \
57     | awk -F "[_=]" '{print tolower($5);}'
58}
59
60case ${TYPE} in
61    target|subtarget|profile) get_${TYPE} ;;
62    *)
63        echo "Unknown type '${TYPE}' specified"
64        exit 1
65    ;;
66esac
67
68
Note: See TracBrowser for help on using the repository browser.