Add conditional check to modify patch based on content.
@@ -81,7 +81,11 @@ runs:
run: |
cd "$COMMON"
# Apply SUSFS core patch
- sed -i 's/end = VMA_PAD_START(vma);/end = vma->vm_end;/' 50_add_susfs_in_gki-$ANDROID_VERSION-$KERNEL_VERSION.patch
+
+ if grep -q 'VMA_PAD_START(vma)' 50_add_susfs_in_gki-$ANDROID_VERSION-$KERNEL_VERSION.patch; then
+ sed -i 's/VMA_PAD_START(vma)/vma->vm_end/' 50_add_susfs_in_gki-$ANDROID_VERSION-$KERNEL_VERSION.patch
+ fi
patch -p1 < 50_add_susfs_in_gki-$ANDROID_VERSION-$KERNEL_VERSION.patch || true
rm -rf 50_add_susfs_in_gki-$ANDROID_VERSION-$KERNEL_VERSION.patch