use quotes when checking empty strings in scripts
this is far less error-prone Signed-off-by: Leah Rowe <leah@libreboot.org>btrfsvols
parent
0fad3497b8
commit
4708da2ca9
|
@ -41,11 +41,11 @@ handle_coreboot_utils()
|
||||||
{
|
{
|
||||||
for util in cbfstool ifdtool; do
|
for util in cbfstool ifdtool; do
|
||||||
x_ ./update project build ${_f} "src/coreboot/${1}/util/${util}"
|
x_ ./update project build ${_f} "src/coreboot/${1}/util/${util}"
|
||||||
[ -z ${mode} ] && [ ! -f "cbutils/${1}/${util}" ] && \
|
[ -z "${mode}" ] && [ ! -f "cbutils/${1}/${util}" ] && \
|
||||||
x_ mkdir -p "cbutils/${1}" && \
|
x_ mkdir -p "cbutils/${1}" && \
|
||||||
x_ cp "src/coreboot/${1}/util/${util}/${util}" \
|
x_ cp "src/coreboot/${1}/util/${util}/${util}" \
|
||||||
"cbutils/${1}"
|
"cbutils/${1}"
|
||||||
[ -z ${mode} ] || \
|
[ -z "${mode}" ] || \
|
||||||
x_ rm -Rf "cbutils/${1}"
|
x_ rm -Rf "cbutils/${1}"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,15 +72,15 @@ check_target()
|
||||||
# Override the above defaults using target.cfg
|
# Override the above defaults using target.cfg
|
||||||
. "${targetdir}/target.cfg"
|
. "${targetdir}/target.cfg"
|
||||||
|
|
||||||
[ -z ${grub_scan_disk} ] && \
|
[ -z "${grub_scan_disk}" ] && \
|
||||||
grub_scan_disk="both"
|
grub_scan_disk="both"
|
||||||
[ "${grub_scan_disk}" != "both" ] && [ "${grub_scan_disk}" != "ata" ] \
|
[ "${grub_scan_disk}" != "both" ] && [ "${grub_scan_disk}" != "ata" ] \
|
||||||
&& [ "${grub_scan_disk}" != "ahci" ] && \
|
&& [ "${grub_scan_disk}" != "ahci" ] && \
|
||||||
grub_scan_disk="both"
|
grub_scan_disk="both"
|
||||||
|
|
||||||
[ -z ${tree} ] && \
|
[ -z "${tree}" ] && \
|
||||||
err "Target '${board}' defines no tree. Skipping build."
|
err "Target '${board}' defines no tree. Skipping build."
|
||||||
[ -z ${arch} ] && \
|
[ -z "${arch}" ] && \
|
||||||
err "Target '${board}' defines no arch. Skipping build."
|
err "Target '${board}' defines no arch. Skipping build."
|
||||||
|
|
||||||
[ "${payload_memtest}" != "y" ] && \
|
[ "${payload_memtest}" != "y" ] && \
|
||||||
|
@ -104,13 +104,13 @@ check_target()
|
||||||
|
|
||||||
[ "${payload_uboot}" != "n" ] && [ "${payload_uboot}" != "y" ] && \
|
[ "${payload_uboot}" != "n" ] && [ "${payload_uboot}" != "y" ] && \
|
||||||
payload_uboot="n"
|
payload_uboot="n"
|
||||||
[ "${payload_uboot}" = "y" ] && [ -z ${uboot_config} ] && \
|
[ "${payload_uboot}" = "y" ] && [ -z "${uboot_config}" ] && \
|
||||||
uboot_config="default"
|
uboot_config="default"
|
||||||
[ "${vendorfiles}" != "n" ] && [ "${vendorfiles}" != "y" ] && \
|
[ "${vendorfiles}" != "n" ] && [ "${vendorfiles}" != "y" ] && \
|
||||||
vendorfiles="y"
|
vendorfiles="y"
|
||||||
|
|
||||||
# Override all payload directives with cmdline args
|
# Override all payload directives with cmdline args
|
||||||
[ -z ${_payload} ] && return 0
|
[ -z "${_payload}" ] && return 0
|
||||||
printf "setting payload to: %s\n" "${_payload}"
|
printf "setting payload to: %s\n" "${_payload}"
|
||||||
eval "$(setvars "n" payload_grub payload_memtest payload_seabios \
|
eval "$(setvars "n" payload_grub payload_memtest payload_seabios \
|
||||||
payload_seabios_withgrub payload_uboot payload_grub_withseabios)"
|
payload_seabios_withgrub payload_uboot payload_grub_withseabios)"
|
||||||
|
@ -192,7 +192,7 @@ build_target()
|
||||||
hmode="vesafb"
|
hmode="vesafb"
|
||||||
[ "${initmode}" = "vgarom" ] || hmode="corebootfb"
|
[ "${initmode}" = "vgarom" ] || hmode="corebootfb"
|
||||||
modes="${hmode} txtmode"
|
modes="${hmode} txtmode"
|
||||||
[ -z ${_displaymode} ] || modes="${_displaymode}"
|
[ -z "${_displaymode}" ] || modes="${_displaymode}"
|
||||||
for y in ${modes}; do
|
for y in ${modes}; do
|
||||||
displaymode="${y}"
|
displaymode="${y}"
|
||||||
[ "${initmode}" = "normal" ] && \
|
[ "${initmode}" = "normal" ] && \
|
||||||
|
@ -289,7 +289,7 @@ build_grub_roms()
|
||||||
for kmapfile in "${kmapdir}"/*; do
|
for kmapfile in "${kmapdir}"/*; do
|
||||||
keymaps="${keymaps} ${kmapfile}"
|
keymaps="${keymaps} ${kmapfile}"
|
||||||
done
|
done
|
||||||
[ -z ${_keyboard} ] || keymaps="${kmapdir}/${_keyboard}.gkb"
|
[ -z "${_keyboard}" ] || keymaps="${kmapdir}/${_keyboard}.gkb"
|
||||||
|
|
||||||
for keymapfile in ${keymaps}; do
|
for keymapfile in ${keymaps}; do
|
||||||
[ -f "${keymapfile}" ] || continue
|
[ -f "${keymapfile}" ] || continue
|
||||||
|
|
|
@ -33,8 +33,8 @@ main()
|
||||||
esac
|
esac
|
||||||
shift; project="${OPTARG#src/}"; shift
|
shift; project="${OPTARG#src/}"; shift
|
||||||
done
|
done
|
||||||
[ -z ${_f} ] && err "flag not specified (-m, -u, -b, -c or -x)"
|
[ -z "${_f}" ] && err "flag not specified (-m, -u, -b, -c or -x)"
|
||||||
[ -z ${project} ] && err "project name not specified"
|
[ -z "${project}" ] && err "project name not specified"
|
||||||
|
|
||||||
if [ ! -f "config/${project}/build.list" ]; then
|
if [ ! -f "config/${project}/build.list" ]; then
|
||||||
build_projects $@
|
build_projects $@
|
||||||
|
@ -80,7 +80,7 @@ build_targets()
|
||||||
err "Cannot get options for ${cfgsdir}"
|
err "Cannot get options for ${cfgsdir}"
|
||||||
[ $# -gt 0 ] && targets=$@
|
[ $# -gt 0 ] && targets=$@
|
||||||
|
|
||||||
[ -z ${mode} ] && x_ mkdir -p "${elfdir}/"
|
[ -z "${mode}" ] && x_ mkdir -p "${elfdir}/"
|
||||||
|
|
||||||
handle_targets
|
handle_targets
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ handle_targets()
|
||||||
done
|
done
|
||||||
|
|
||||||
[ "${target1}" = "utils" ] && [ "${project}" = "coreboot" ] && return 0
|
[ "${target1}" = "utils" ] && [ "${project}" = "coreboot" ] && return 0
|
||||||
[ -z ${mode} ] || return 0
|
[ -z "${mode}" ] || return 0
|
||||||
printf "Done! The files are stored under %s/\n\n" "${elfdir}"
|
printf "Done! The files are stored under %s/\n\n" "${elfdir}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,9 +138,9 @@ handle_src_tree()
|
||||||
# Override the above defaults using target.cfg
|
# Override the above defaults using target.cfg
|
||||||
. "${target_dir}/target.cfg" # source
|
. "${target_dir}/target.cfg" # source
|
||||||
|
|
||||||
[ -z ${tree} ] && \
|
[ -z "${tree}" ] && \
|
||||||
err "handle_src_tree: ${target_dir}: tree undefined"
|
err "handle_src_tree: ${target_dir}: tree undefined"
|
||||||
[ -z ${arch} ] && \
|
[ -z "${arch}" ] && \
|
||||||
err "handle_src_tree: ${target_dir}: undefined cpu type"
|
err "handle_src_tree: ${target_dir}: undefined cpu type"
|
||||||
|
|
||||||
codedir="src/${project}/${tree}"
|
codedir="src/${project}/${tree}"
|
||||||
|
@ -260,7 +260,7 @@ run_make_command()
|
||||||
{
|
{
|
||||||
[ -f "${codedir}/Makefile" ] || [ -f "${codedir}/makefile" ] || \
|
[ -f "${codedir}/Makefile" ] || [ -f "${codedir}/makefile" ] || \
|
||||||
[ -f "${codedir}/GNUmakefile" ] || return 1
|
[ -f "${codedir}/GNUmakefile" ] || return 1
|
||||||
[ "${project}" = "coreboot" ] && [ -z ${mode} ] && \
|
[ "${project}" = "coreboot" ] && [ -z "${mode}" ] && \
|
||||||
x_ printf "%s\n" "${version}" >"${codedir}/.coreboot-version"
|
x_ printf "%s\n" "${version}" >"${codedir}/.coreboot-version"
|
||||||
|
|
||||||
x_ make -C "${codedir}" -j$(nproc) ${mode}
|
x_ make -C "${codedir}" -j$(nproc) ${mode}
|
||||||
|
|
|
@ -66,8 +66,8 @@ fetch_config()
|
||||||
err "fetch_config: no \"${cfgsdir}/${_target}/target.cfg\""
|
err "fetch_config: no \"${cfgsdir}/${_target}/target.cfg\""
|
||||||
|
|
||||||
[ "${_target}" != "${tree}" ] && _target="${tree}" && continue
|
[ "${_target}" != "${tree}" ] && _target="${tree}" && continue
|
||||||
[ -z ${tree} ] && err "${_xm}: tree undefined"
|
[ -z "${tree}" ] && err "${_xm}: tree undefined"
|
||||||
[ -z ${rev} ] && err "${_xm}: revision undefined"
|
[ -z "${rev}" ] && err "${_xm}: revision undefined"
|
||||||
break
|
break
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,7 +105,7 @@ create_release_archive()
|
||||||
|
|
||||||
fail()
|
fail()
|
||||||
{
|
{
|
||||||
[ -z ${srcdir} ] || rm -Rf "${srcdir}" 1>/dev/null 2>/dev/null || :
|
[ -z "${srcdir}" ] || rm -Rf "${srcdir}" 1>/dev/null 2>/dev/null || :
|
||||||
fail "${1}"
|
fail "${1}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ check_board()
|
||||||
if ! check_release "${archive}" ; then
|
if ! check_release "${archive}" ; then
|
||||||
[ -f "${rom}" ] || \
|
[ -f "${rom}" ] || \
|
||||||
err "check_board: \"${rom}\" is not a valid path"
|
err "check_board: \"${rom}\" is not a valid path"
|
||||||
[ -z ${rom+x} ] && \
|
[ -z "${rom+x}" ] && \
|
||||||
err "check_board: no rom specified"
|
err "check_board: no rom specified"
|
||||||
[ ! -z ${board+x} ] || \
|
[ ! -z ${board+x} ] || \
|
||||||
board=$(detect_board "${rom}")
|
board=$(detect_board "${rom}")
|
||||||
|
@ -214,7 +214,7 @@ inject_vendorfile_intel_me()
|
||||||
printf "adding intel me firmware\n"
|
printf "adding intel me firmware\n"
|
||||||
|
|
||||||
rom="${1}"
|
rom="${1}"
|
||||||
[ -z ${CONFIG_ME_BIN_PATH} ] && \
|
[ -z "${CONFIG_ME_BIN_PATH}" ] && \
|
||||||
err "inject_vendorfile_intel_me: CONFIG_ME_BIN_PATH not set"
|
err "inject_vendorfile_intel_me: CONFIG_ME_BIN_PATH not set"
|
||||||
|
|
||||||
_me_location=${CONFIG_ME_BIN_PATH##*../}
|
_me_location=${CONFIG_ME_BIN_PATH##*../}
|
||||||
|
@ -282,7 +282,7 @@ inject_vendorfile_smsc_sch5545_ec()
|
||||||
modify_gbe()
|
modify_gbe()
|
||||||
{
|
{
|
||||||
printf "changing mac address in gbe to ${new_mac}\n"
|
printf "changing mac address in gbe to ${new_mac}\n"
|
||||||
[ -z ${CONFIG_GBE_BIN_PATH} ] && \
|
[ -z "${CONFIG_GBE_BIN_PATH}" ] && \
|
||||||
err "modify_gbe: ${board}: CONFIG_GBE_BIN_PATH not set"
|
err "modify_gbe: ${board}: CONFIG_GBE_BIN_PATH not set"
|
||||||
|
|
||||||
rom="${1}"
|
rom="${1}"
|
||||||
|
|
Loading…
Reference in New Issue