mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-09 05:56:58 +02:00
flatcar_workon: Bring back the --host flag
Telling flatcar_workon to work on SDK instead of a board could be implemented either by passing an empty value for --board flag and modifying `${FLAGS_board+foo}` to `${FLAGS_board:+foo}` or by adding the `--host` boolean flag and killing the value of `--board` flag when `--host` is true. I went with the latter as it clearly conveys meaning at the call sites.
This commit is contained in:
parent
02a1191153
commit
e30ca8dab6
@ -6,6 +6,8 @@
|
|||||||
|
|
||||||
DEFINE_string board "${DEFAULT_BOARD}" \
|
DEFINE_string board "${DEFAULT_BOARD}" \
|
||||||
"The board to set package keywords for."
|
"The board to set package keywords for."
|
||||||
|
DEFINE_boolean host "${FLAGS_FALSE}" \
|
||||||
|
"Uses the host instead of board"
|
||||||
|
|
||||||
FLAGS_HELP="usage: $0 <command> [flags] <atom>
|
FLAGS_HELP="usage: $0 <command> [flags] <atom>
|
||||||
commands:
|
commands:
|
||||||
@ -17,6 +19,13 @@ eval set -- "${FLAGS_ARGV}"
|
|||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
|
# If both board and host are specified, just use host, because board
|
||||||
|
# does not have to be specified and may come from default, in which
|
||||||
|
# case there's no way to override.
|
||||||
|
if [[ -n ${FLAGS_board} ]] && [[ ${FLAGS_host} = "${FLAGS_TRUE}" ]]; then
|
||||||
|
unset FLAGS_board # kill board
|
||||||
|
fi
|
||||||
|
|
||||||
# /etc/portage under either / or /build/<board>.
|
# /etc/portage under either / or /build/<board>.
|
||||||
ETC_PORTAGE=${FLAGS_board+/build/${FLAGS_board}}/etc/portage
|
ETC_PORTAGE=${FLAGS_board+/build/${FLAGS_board}}/etc/portage
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user