From ab65ea4c99af4f5569496c58b604ada612a2469a Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Fri, 22 Dec 2023 09:46:43 +0000 Subject: general code cleanup Signed-off-by: Leah Rowe --- include/git.sh | 9 ++------- include/option.sh | 6 ++++++ 2 files changed, 8 insertions(+), 7 deletions(-) (limited to 'include') diff --git a/include/git.sh b/include/git.sh index e361cb41..1d63f99c 100755 --- a/include/git.sh +++ b/include/git.sh @@ -58,10 +58,7 @@ prepare_new_tree() { printf "Creating %s tree %s (%s)\n" "${project}" "${tree}" "${_target}" - rm -Rf "${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" + remkdir "${tmp_git_dir%/*}" cp -R "src/${project}/${project}" "${tmp_git_dir}" || \ err "prepare_new_tree ${project}/${tree}: can't make tmpclone" git_reset_rev "${tmp_git_dir}" "${rev}" @@ -98,9 +95,7 @@ verify_config() clone_project() { - rm -Rf "${tmp_git_dir}" || err "clone_project: !rm -Rf ${tmp_git_dir}" - mkdir -p "${tmp_git_dir%/*}" || \ - err "clone_project: !mkdir -p ${tmp_git_dir%/*}" + remkdir "${tmp_git_dir%/}" loc="${loc#src/}" loc="src/${loc}" diff --git a/include/option.sh b/include/option.sh index a764bc33..44952d09 100755 --- a/include/option.sh +++ b/include/option.sh @@ -74,3 +74,9 @@ handle_coreboot_utils() [ -z "${mode}" ] || x_ rm -Rf "cbutils/${1}" done } + +remkdir() +{ + rm -Rf "${1}" || err "remkdir: !rm -Rf \"${1}\"" + mkdir -p "${1}" || err "remkdir: !mkdir -p \"${1}\"" +} -- cgit v1.2.1