4 # The location of the br2-external tree, once validated.
11 while getopts :ho
: OPT
; do
14 o
) ofile
="${OPTARG}";;
15 :) error
"option '%s' expects a mandatory argument\n" "${OPTARG}";;
16 \?) error
"unknown option '%s'\n" "${OPTARG}";;
19 # Forget options; keep only positional args
22 if [ ${#} -ne 1 ]; then
23 error
"need exactly one br2-external tree to be specified\n"
27 if [ -z "${ofile}" ]; then
28 error
"no output file specified (-o)\n"
31 do_validate
"${br2_ext}"
33 do_kconfig
>"${ofile}"
36 # Validates the br2-external tree passed as argument. Makes it cannonical
37 # and store it in global variable BR2_EXT.
41 if [ ! -d "${br2_ext}" ]; then
42 error
"'%s': no such file or directory\n" "${br2_ext}"
44 if [ ! -r "${br2_ext}" -o ! -x "${br2_ext}" ]; then
45 error
"'%s': permission denied\n" "${br2_ext}"
48 BR2_EXT
="$(cd "${br2_ext}"; pwd -P )"
51 # Generate the kconfig snippet for the br2-external tree.
53 printf '#\n# Automatically generated file; DO NOT EDIT.\n#\n'
55 printf 'config BR2_EXTERNAL\n'
57 printf '\tdefault "%s"\n' "${BR2_EXT}"
59 printf 'menu "User-provided options"\n'
60 printf '\tdepends on BR2_EXTERNAL != "support/dummy-external"\n'
62 printf 'source "%s/Config.in"\n' "${BR2_EXT}"
64 printf "endmenu # User-provided options\n"
70 ${my_name} -o FILE PATH
72 ${my_name} generates the kconfig snippet to include the configuration
73 options specified in the br2-external tree passed as positional argument.
77 FILE in which to generate the kconfig snippet.
85 error
() { local fmt="${1}"; shift; printf "%s: ${fmt}" "${my_name}" "${@}" >&2; exit 1; }