66# Usage: ./utils/kernel-upgrade.sh <path-to-linux-dir>
77#
88
9- set -e
9+ set -e -o pipefail
1010
1111# Parse arguments
1212if [ $# -ne 1 ]; then
@@ -139,15 +139,6 @@ rebase_kernel() {
139139 log_info " Run 'git rebase --abort' to cancel or resolve conflicts manually"
140140 exit 1
141141 fi
142-
143- # Push rebased branch to kkit remote
144- log_info " Pushing rebased branch to $KKIT_REMOTE ..."
145- if git -C " $LINUX_DIR " push " $KKIT_REMOTE " " $LINUX_BRANCH " --force-with-lease; then
146- log_info " Successfully pushed to $KKIT_REMOTE "
147- else
148- log_error " Push failed"
149- exit 1
150- fi
151142}
152143
153144# Update infix and run kernel refresh
@@ -195,8 +186,8 @@ update_infix() {
195186
196187 # Check if versions are the same
197188 if [ " $OLD_VERSION " = " $NEW_VERSION " ]; then
198- log_info " Kernel version unchanged ($OLD_VERSION ), skipping refresh "
199- return 0
189+ log_info " Kernel version unchanged ($OLD_VERSION ), nothing to do "
190+ exit 0
200191 fi
201192
202193 # Run kernel refresh script
@@ -231,6 +222,16 @@ update_infix() {
231222 else
232223 log_warn " doc/ChangeLog.md not found, skipping changelog update"
233224 fi
225+
226+ # Commit all changes
227+ log_info " Committing changes to infix..."
228+ git -C " $INFIX_DIR " add -A
229+ if git -C " $INFIX_DIR " diff-index --quiet HEAD --; then
230+ log_info " No changes to commit"
231+ else
232+ git -C " $INFIX_DIR " commit -m " Upgrade Linux kernel to $NEW_VERSION "
233+ log_info " Changes committed"
234+ fi
234235}
235236
236237# Check for uncommitted changes
@@ -254,6 +255,29 @@ check_clean_working_tree() {
254255 log_info " Working tree is clean"
255256}
256257
258+ # Push changes to remotes
259+ push_changes () {
260+ log_info " Pushing changes to remotes..."
261+
262+ # Push rebased linux branch to kkit remote
263+ log_info " Pushing rebased linux branch to $KKIT_REMOTE ..."
264+ if git -C " $LINUX_DIR " push " $KKIT_REMOTE " " $LINUX_BRANCH " --force-with-lease; then
265+ log_info " Successfully pushed linux branch to $KKIT_REMOTE "
266+ else
267+ log_error " Push to linux remote failed"
268+ exit 1
269+ fi
270+
271+ # Push infix branch to origin
272+ log_info " Pushing infix branch to origin..."
273+ if git -C " $INFIX_DIR " push origin " $INFIX_BRANCH " ; then
274+ log_info " Successfully pushed infix branch to origin"
275+ else
276+ log_error " Push to infix remote failed"
277+ exit 1
278+ fi
279+ }
280+
257281# Main execution
258282main () {
259283 log_info " Starting automated kernel upgrade test..."
@@ -265,6 +289,7 @@ main() {
265289 update_linux_kernel
266290 rebase_kernel
267291 update_infix
292+ push_changes
268293
269294 log_info " Kernel upgrade completed successfully!"
270295}
0 commit comments