File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -254,12 +254,22 @@ update_changelog() {
254254 fi
255255
256256 # Extract just the UNRELEASED section (from start until next version header)
257- UNRELEASED_SECTION=$( sed -n ' 1,/^\[v[0-9]/p' doc/ChangeLog.md | head -n -1)
257+ # Need to find the second [v occurrence (first is UNRELEASED itself, second is previous release)
258+ UNRELEASED_SECTION=$( awk ' /^\[v[0-9]/ { count++; if (count == 2) exit } { print }' doc/ChangeLog.md)
258259
259260 # Check if there's already a kernel upgrade entry in the UNRELEASED section
260261 if echo " $UNRELEASED_SECTION " | grep -q " ^- Upgrade Linux kernel to" ; then
261- # Update existing kernel upgrade line (only first occurrence)
262- sed -i " 0,/^- Upgrade Linux kernel to.*/{s|^- Upgrade Linux kernel to.*|- Upgrade Linux kernel to $NEW_VERSION (LTS)|}" doc/ChangeLog.md
262+ # Update existing kernel upgrade line in UNRELEASED section only
263+ # Find a real release marker (not UNRELEASED), then replace before that
264+ awk -v new_version=" $NEW_VERSION " '
265+ /^\[v[0-9]/ && !/UNRELEASED/ { found_version=1 }
266+ /^- Upgrade Linux kernel to/ && !found_version && !replaced {
267+ print "- Upgrade Linux kernel to " new_version " (LTS)"
268+ replaced=1
269+ next
270+ }
271+ {print}
272+ ' doc/ChangeLog.md > doc/ChangeLog.md.tmp && mv doc/ChangeLog.md.tmp doc/ChangeLog.md
263273 log_info " Updated existing kernel version entry to $NEW_VERSION "
264274 else
265275 # Add new kernel upgrade entry after first "### Changes"
You can’t perform that action at this time.
0 commit comments