Просмотр исходного кода

ci(apply-kernel-branding): fix output redirection in branding script

The sed command was incorrectly deleting the last line containing 'echo' and then appending the branding echo, which could lead to malformed scripts. Directly writing the echo command to the file ensures the script is correctly generated for Wild kernel variants.
TheWildJames 4 месяцев назад
Родитель
Сommit
1bef322ed1
1 измененных файлов с 3 добавлено и 3 удалено
  1. 3 3
      .github/actions/apply-kernel-branding/action.yml

+ 3 - 3
.github/actions/apply-kernel-branding/action.yml

@@ -24,11 +24,11 @@ runs:
         DEFCONFIG="${GITHUB_WORKSPACE}/kernel/common/arch/arm64/configs/gki_defconfig"
 
         if [ "${{ inputs.variant }}" = "Wild" ]; then
-          sed -i '${/^echo /d;}' scripts/setlocalversion
+          sed -i ':a; $!{N; ba}; s/\n\([^\n]*^echo [^\n]*\)\n$/\n/;' scripts/setlocalversion
           if [ "$(printf '%s\n' "${{ inputs.kernel_version }}" "6.6" | sort -V | head -n1)" = "6.6" ]; then
-            echo 'echo "${KERNELVERSION}-Wild"'
+            echo 'echo "${KERNELVERSION}-Wild"' >> scripts/setlocalversion
           else
-            echo 'echo "-Wild"'
+            echo 'echo "-Wild"' >> scripts/setlocalversion
           fi
         else
           if grep -q '^CONFIG_LOCALVERSION=' "$DEFCONFIG"; then