mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-24 21:31:35 +02:00
move build/command/options to include/option.sh
Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
@@ -1,30 +1,18 @@
|
|||||||
#!/usr/bin/env sh
|
|
||||||
# SPDX-License-Identifier: MIT
|
# SPDX-License-Identifier: MIT
|
||||||
# SPDX-FileCopyrightText: 2023 Leah Rowe <leah@libreboot.org>
|
# SPDX-FileCopyrightText: 2023 Leah Rowe <leah@libreboot.org>
|
||||||
|
|
||||||
. "include/err.sh"
|
|
||||||
|
|
||||||
items=1
|
|
||||||
|
|
||||||
main()
|
|
||||||
{
|
|
||||||
[ $# -gt 0 ] || \
|
|
||||||
err "No argument given"
|
|
||||||
listitems "${1}" || err "No items present under: ${1}"
|
|
||||||
}
|
|
||||||
|
|
||||||
listitems()
|
listitems()
|
||||||
{
|
{
|
||||||
[ -d "${1}" ] || \
|
rval=1
|
||||||
err "Directory not does exist: ${1}"
|
[ ! -d "${1}" ] && \
|
||||||
|
printf "listitems: directory '%s' doesn't exist" "${1}" && \
|
||||||
|
return 1
|
||||||
for x in "${1}/"*; do
|
for x in "${1}/"*; do
|
||||||
# -e used because this is for files *or* directories
|
# -e used because this is for files *or* directories
|
||||||
[ -e "${x}" ] || continue
|
[ -e "${x}" ] || continue
|
||||||
[ "${x##*/}" = "build.list" ] && continue
|
[ "${x##*/}" = "build.list" ] && continue
|
||||||
printf "%s\n" "${x##*/}" 2>/dev/null
|
printf "%s\n" "${x##*/}" 2>/dev/null
|
||||||
items=0
|
rval=0
|
||||||
done
|
done
|
||||||
return ${items}
|
return ${rval}
|
||||||
}
|
}
|
||||||
|
|
||||||
main $@
|
|
||||||
@@ -10,6 +10,7 @@ set -u -e
|
|||||||
|
|
||||||
. "include/err.sh"
|
. "include/err.sh"
|
||||||
. "include/export.sh"
|
. "include/export.sh"
|
||||||
|
. "include/option.sh"
|
||||||
|
|
||||||
read projectname < projectname
|
read projectname < projectname
|
||||||
linkpath="${0}"
|
linkpath="${0}"
|
||||||
@@ -45,7 +46,7 @@ initialise_command()
|
|||||||
fail "running this command as root is not permitted"
|
fail "running this command as root is not permitted"
|
||||||
|
|
||||||
[ "${mode}" = "help" ] && usage ${0} && lbmk_exit 0
|
[ "${mode}" = "help" ] && usage ${0} && lbmk_exit 0
|
||||||
[ "${mode}" = "list" ] && ./build command options "${buildpath}" && \
|
[ "${mode}" = "list" ] && listitems "${buildpath}" && \
|
||||||
lbmk_exit 0
|
lbmk_exit 0
|
||||||
[ $# -lt 2 ] && usage ${0} && lbmk_exit 1
|
[ $# -lt 2 ] && usage ${0} && lbmk_exit 1
|
||||||
|
|
||||||
@@ -78,7 +79,7 @@ install_packages()
|
|||||||
execute_command()
|
execute_command()
|
||||||
{
|
{
|
||||||
if [ "${option}" = "list" ]; then
|
if [ "${option}" = "list" ]; then
|
||||||
./build command options "${buildpath}/${mode}" || \
|
listitems "${buildpath}/${mode}" || \
|
||||||
fail "execute_command: cannot list command options"
|
fail "execute_command: cannot list command options"
|
||||||
lbmk_exit 0
|
lbmk_exit 0
|
||||||
fi
|
fi
|
||||||
@@ -95,7 +96,7 @@ usage()
|
|||||||
USAGE: ${progname} <MODE> <OPTION>
|
USAGE: ${progname} <MODE> <OPTION>
|
||||||
|
|
||||||
possible values for 'mode':
|
possible values for 'mode':
|
||||||
$(./build command options "${buildpath}")
|
$(listitems "${buildpath}")
|
||||||
|
|
||||||
For each of the above modes, you may also do:
|
For each of the above modes, you may also do:
|
||||||
${progname} <MODE> list
|
${progname} <MODE> list
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
set -u -e
|
set -u -e
|
||||||
|
|
||||||
. "include/err.sh"
|
. "include/err.sh"
|
||||||
|
. "include/option.sh"
|
||||||
|
|
||||||
read projectname < projectname
|
read projectname < projectname
|
||||||
opts=""
|
opts=""
|
||||||
@@ -23,7 +24,7 @@ main()
|
|||||||
firstoption="${1}"
|
firstoption="${1}"
|
||||||
[ "${firstoption}" = "help" ] && usage && exit 0
|
[ "${firstoption}" = "help" ] && usage && exit 0
|
||||||
[ "${firstoption}" = "list" ] && \
|
[ "${firstoption}" = "list" ] && \
|
||||||
./build command options config/coreboot && exit 0
|
listitems config/coreboot && exit 0
|
||||||
|
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
case ${1} in
|
case ${1} in
|
||||||
@@ -46,7 +47,7 @@ main()
|
|||||||
printf "Building %s ROM images\n" "${projectname}"
|
printf "Building %s ROM images\n" "${projectname}"
|
||||||
|
|
||||||
if [ "${firstoption}" = "all" ]; then
|
if [ "${firstoption}" = "all" ]; then
|
||||||
for target in $(./build command options config/coreboot); do
|
for target in $(listitems config/coreboot); do
|
||||||
buildrom "${target}" || err "build/roms (1): error"
|
buildrom "${target}" || err "build/roms (1): error"
|
||||||
[ -d "bin/${target}" ] && targets="${target} ${targets}"
|
[ -d "bin/${target}" ] && targets="${target} ${targets}"
|
||||||
done
|
done
|
||||||
@@ -81,7 +82,7 @@ usage()
|
|||||||
./build boot roms x60 -p grub -d corebootfb -k usqwerty
|
./build boot roms x60 -p grub -d corebootfb -k usqwerty
|
||||||
|
|
||||||
possible values for 'target':
|
possible values for 'target':
|
||||||
$(./build command options "config/coreboot")
|
$(listitems "config/coreboot")
|
||||||
|
|
||||||
Refer to the ${projectname} documentation for more information.
|
Refer to the ${projectname} documentation for more information.
|
||||||
EOF
|
EOF
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
set -u -e
|
set -u -e
|
||||||
|
|
||||||
. "include/err.sh"
|
. "include/err.sh"
|
||||||
|
. "include/option.sh"
|
||||||
|
|
||||||
read projectname < projectname
|
read projectname < projectname
|
||||||
read our_version < version
|
read our_version < version
|
||||||
@@ -66,7 +67,7 @@ handle_dependencies()
|
|||||||
[ -f "${listfile}" ] || fail "list file, ${listfile}, does not exist"
|
[ -f "${listfile}" ] || fail "list file, ${listfile}, does not exist"
|
||||||
|
|
||||||
# Build for all targets if no argument is given
|
# Build for all targets if no argument is given
|
||||||
targets=$(./build command options "${cfgsdir}") || \
|
targets=$(listitems "${cfgsdir}") || \
|
||||||
fail "Cannot get options for ${cfgsdir}"
|
fail "Cannot get options for ${cfgsdir}"
|
||||||
[ $# -gt 0 ] && targets=$@
|
[ $# -gt 0 ] && targets=$@
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
. "include/err.sh"
|
. "include/err.sh"
|
||||||
. "include/defconfig.sh"
|
. "include/defconfig.sh"
|
||||||
. "include/blobutil.sh"
|
. "include/blobutil.sh"
|
||||||
|
. "include/option.sh"
|
||||||
|
|
||||||
release_archive="n"
|
release_archive="n"
|
||||||
|
|
||||||
@@ -16,7 +17,7 @@ main()
|
|||||||
|
|
||||||
[ $# -lt 1 ] && err "No options specified."
|
[ $# -lt 1 ] && err "No options specified."
|
||||||
[ "${1}" = "listboards" ] && \
|
[ "${1}" = "listboards" ] && \
|
||||||
./build command options config/coreboot && exit 0
|
listitems config/coreboot && exit 0
|
||||||
|
|
||||||
archive="${1}"
|
archive="${1}"
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ set -u -e
|
|||||||
|
|
||||||
. "include/err.sh"
|
. "include/err.sh"
|
||||||
. "include/git.sh"
|
. "include/git.sh"
|
||||||
|
. "include/option.sh"
|
||||||
|
|
||||||
_target=""
|
_target=""
|
||||||
tree=""
|
tree=""
|
||||||
@@ -29,7 +30,7 @@ main()
|
|||||||
[ -d "${cfgsdir}" ] || err "unsupported project name"
|
[ -d "${cfgsdir}" ] || err "unsupported project name"
|
||||||
shift 1
|
shift 1
|
||||||
|
|
||||||
targets=$(./build command options "${cfgsdir}")
|
targets=$(listitems "${cfgsdir}")
|
||||||
[ $# -gt 0 ] && targets=$@
|
[ $# -gt 0 ] && targets=$@
|
||||||
[ -z "${targets}" ] && \
|
[ -z "${targets}" ] && \
|
||||||
err "No targets available for project: ${project}"
|
err "No targets available for project: ${project}"
|
||||||
|
|||||||
Reference in New Issue
Block a user