general code cleanup

Signed-off-by: Leah Rowe <leah@libreboot.org>
9020vga
Leah Rowe 2023-12-22 09:46:43 +00:00
parent fa25414bab
commit ab65ea4c99
6 changed files with 15 additions and 18 deletions

View File

@ -58,10 +58,7 @@ prepare_new_tree()
{ {
printf "Creating %s tree %s (%s)\n" "${project}" "${tree}" "${_target}" printf "Creating %s tree %s (%s)\n" "${project}" "${tree}" "${_target}"
rm -Rf "${tmp_git_dir%/*}" || \ remkdir "${tmp_git_dir%/*}"
err "prepare_new_tree ${project}/${tree}: can't rm tmpclone"
mkdir "${tmp_git_dir%/*}" || \
err "prepare_new_tree ${project}/${tree}: can't mkdir tmp"
cp -R "src/${project}/${project}" "${tmp_git_dir}" || \ cp -R "src/${project}/${project}" "${tmp_git_dir}" || \
err "prepare_new_tree ${project}/${tree}: can't make tmpclone" err "prepare_new_tree ${project}/${tree}: can't make tmpclone"
git_reset_rev "${tmp_git_dir}" "${rev}" git_reset_rev "${tmp_git_dir}" "${rev}"
@ -98,9 +95,7 @@ verify_config()
clone_project() clone_project()
{ {
rm -Rf "${tmp_git_dir}" || err "clone_project: !rm -Rf ${tmp_git_dir}" remkdir "${tmp_git_dir%/}"
mkdir -p "${tmp_git_dir%/*}" || \
err "clone_project: !mkdir -p ${tmp_git_dir%/*}"
loc="${loc#src/}" loc="${loc#src/}"
loc="src/${loc}" loc="src/${loc}"

View File

@ -74,3 +74,9 @@ handle_coreboot_utils()
[ -z "${mode}" ] || x_ rm -Rf "cbutils/${1}" [ -z "${mode}" ] || x_ rm -Rf "cbutils/${1}"
done done
} }
remkdir()
{
rm -Rf "${1}" || err "remkdir: !rm -Rf \"${1}\""
mkdir -p "${1}" || err "remkdir: !mkdir -p \"${1}\""
}

View File

@ -164,9 +164,8 @@ build_dependency_seabios()
build_dependency_grub() build_dependency_grub()
{ {
[ "${payload_grub}" != "y" ] && \ [ "$payload_grub" != "y" ] && [ "$payload_seabios_withgrub" != "y" ] \
[ "${payload_seabios_withgrub}" != "y" ] && \ && [ "${payload_seabios_grubonly}" != "y" ] && return 0
[ "${payload_seabios_grubonly}" != "y" ] && return 0
rebuild_grub="n" rebuild_grub="n"
[ -f "${grubelf}" ] || rebuild_grub="y" [ -f "${grubelf}" ] || rebuild_grub="y"
@ -418,7 +417,7 @@ moverom() {
[ "${vendorfiles}" = "n" ] && newrom="${newrom%.rom}_noblobs.rom" [ "${vendorfiles}" = "n" ] && newrom="${newrom%.rom}_noblobs.rom"
printf "Creating target image: %s\n" "${newrom}" printf "Creating target image: %s\n" "${newrom}"
[ -d "${newrom%/*}" ] || x_ mkdir -p "${newrom%/*}/" x_ mkdir -p "${newrom%/*}"
x_ cp "${rompath}" "${newrom}" x_ cp "${rompath}" "${newrom}"
} }

View File

@ -179,7 +179,7 @@ handle_rom_archive()
insert_version_files "${romdir}" || \ insert_version_files "${romdir}" || \
err "mkrom_tarball ${romdir}: versionfile" err "mkrom_tarball ${romdir}: versionfile"
insert_copying_files "${romdir}" || err "!insert copy, handle 2, ${romdir}" insert_copying_files "$romdir" || err "!insert copy, handle 2, $romdir"
mkrom_tarball mkrom_tarball
} }
@ -233,8 +233,7 @@ strip_ucode()
insert_copying_files() insert_copying_files()
{ {
rm -Rf "${1}/licenses" || return 1 remkdir "${1}/licenses"
mkdir -p "${1}/licenses" || return 1
l="${1}/licenses" l="${1}/licenses"
# copy licenses to rom image archive, for completion # copy licenses to rom image archive, for completion
cp "src/grub/COPYING" "${l}/COPYING.grub" || return 1 cp "src/grub/COPYING" "${l}/COPYING.grub" || return 1

View File

@ -146,8 +146,7 @@ mkdirs()
return 1 return 1
fi fi
mkdir -p "${1%/*}" || err "mkdirs: !mkdir -p ${1%/*}" mkdir -p "${1%/*}" || err "mkdirs: !mkdir -p ${1%/*}"
x_ rm -Rf "${appdir}" remkdir "${appdir}"
x_ mkdir -p "${appdir}/"
if [ "${is_rom}" = "y" ]; then if [ "${is_rom}" = "y" ]; then
cp "${_dl}" "${appdir}" || \ cp "${_dl}" "${appdir}" || \
err "mkdirs copyrom ${_dl}: can't copy to appdir" err "mkdirs copyrom ${_dl}: can't copy to appdir"

View File

@ -114,8 +114,7 @@ inject_vendorfiles()
patch_release_roms() patch_release_roms()
{ {
_tmpdir="tmp/romdir" _tmpdir="tmp/romdir"
x_ rm -Rf "${_tmpdir}" remkdir "${_tmpdir}"
x_ mkdir -p "${_tmpdir}"
tar -xf "${archive}" -C "${_tmpdir}" || \ tar -xf "${archive}" -C "${_tmpdir}" || \
err "patch_release_roms: !tar -xf \"${archive}\" -C \"${_tmpdir}\"" err "patch_release_roms: !tar -xf \"${archive}\" -C \"${_tmpdir}\""