diff options
author | Olliver Schinagl <oliver@schinagl.nl> | 2024-03-18 13:28:11 +0100 |
---|---|---|
committer | Robert Marko <robimarko@gmail.com> | 2024-04-12 18:20:53 +0200 |
commit | b62aafc99a6f00032c0486d96bb7b6cc0a77a84c (patch) | |
tree | 8110741230278068441709ef6fce559923fc39ac /scripts | |
parent | 8ed187e471b0f7622c8791bf688302cdfe484868 (diff) | |
download | openwrt-b62aafc99a6f00032c0486d96bb7b6cc0a77a84c.tar.gz openwrt-b62aafc99a6f00032c0486d96bb7b6cc0a77a84c.tar.bz2 openwrt-b62aafc99a6f00032c0486d96bb7b6cc0a77a84c.zip |
scripts/kernel_bump: Use the git index to find the needed config files
The current solution using `find` introduces a racecondition, where `find`
and `git mv` get in each others way. While this could be fixed with
more-utils sponge command (or even sort -u) to buffer the output of
find.
However, a much better approach, is to query the git index directly,
which will not change, and is far more accurate.
Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/kernel_bump.sh | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/scripts/kernel_bump.sh b/scripts/kernel_bump.sh index d9fc5287df..7ce3b6256f 100755 --- a/scripts/kernel_bump.sh +++ b/scripts/kernel_bump.sh @@ -137,9 +137,15 @@ bump_kernel() done fi - find "${_target_dir}" -iname "config-${source_version}" | while read -r _config; do - _path="${_config%%"/config-${source_version}"}" - git mv "${_config}" "${_path}/config-${target_version}" + for _config in $(git ls-files "${_target_dir}" | + sed -n "s|^\(.*config-${source_version}\).*|\1|p" | + sort -u); do + if [ ! -e "${_config}" ]; then + continue + fi + + _subtarget="${_config%%"/config-${source_version}"}" + git mv "${_config}" "${_subtarget}/config-${target_version}" done git commit \ |