mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-11 22:12:40 +02:00
a823bab365
This is done recursively, with the following rule: files first, then directories. Where all patch files are applied from within the patch directory, subdirectories (within the patch directory) are then tried in alphanumerical order. Then, within each subdirectory tried, the same rule is once again applied. This is done recursively, until every patch file is applied. The code no longer applies *.patch, but instead any file. Additionally, symlinks are avoided. Signed-off-by: Leah Rowe <leah@libreboot.org>
28 lines
746 B
Bash
Executable File
28 lines
746 B
Bash
Executable File
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
# SPDX-FileCopyrightText: 2023 Leah Rowe <leah@libreboot.org>
|
|
|
|
git_am_patches()
|
|
{
|
|
sdir="${1}" # assumed to be absolute path
|
|
patchdir="${2}" # ditto
|
|
_fail="${3}"
|
|
(
|
|
cd "${sdir}" || \
|
|
"${_fail}" "apply_patches: !cd \"${sdir}\""
|
|
for patch in "${patchdir}/"*; do
|
|
[ -L "${patch}" ] && continue
|
|
[ -f "${patch}" ] || continue
|
|
if ! git am "${patch}"; then
|
|
git am --abort || "${_fail}" "${sdir}: !git am --abort"
|
|
"${_fail}" "!git am ${patch} -> ${sdir}"
|
|
fi
|
|
done
|
|
)
|
|
for patches in "${patchdir}/"*; do
|
|
[ -L "${patches}" ] && continue
|
|
[ ! -d "${patches}" ] || \
|
|
git_am_patches "${sdir}" "${patches}" "${_fail}" || \
|
|
"${_fail}" "apply_patches: !${sdir}/ ${patches}/"
|
|
done
|
|
}
|