| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- name: Set Kernel Config
- description: Patch gki_defconfig directly (add or modify entries)
- inputs:
- config_list:
- required: true
- description: "Kernel config lines"
- runs:
- using: composite
- steps:
- - name: Patch gki_defconfig
- shell: bash
- working-directory: ${{ github.workspace }}/kernel/common
- run: |
- set -euo pipefail
- DEFCONFIG="arch/arm64/configs/gki_defconfig"
- CONFIG_LIST="${{ inputs.config_list }}"
- if [ ! -f "$DEFCONFIG" ]; then
- echo "ERROR: gki_defconfig not found"
- exit 1
- fi
- apply_line() {
- local line="$1"
- line="$(echo "$line" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
- # skip empty/comments
- [[ -z "$line" || "$line" == \#* ]] && return
- local key value
- if [[ "$line" == *"="* ]]; then
- key="${line%%=*}"
- value="${line#*=}"
- else
- key="$line"
- value="y"
- fi
- echo "Processing: $key=$value"
- # if config exists anywhere in file → replace it
- if grep -q "^$key=" "$DEFCONFIG"; then
- sed -i "s|^$key=.*|$key=$value|g" "$DEFCONFIG"
- elif grep -q "^# $key is not set" "$DEFCONFIG"; then
- sed -i "s|^# $key is not set|$key=$value|g" "$DEFCONFIG"
- else
- # not present → append
- echo "$key=$value" >> "$DEFCONFIG"
- fi
- }
- while IFS= read -r line || [ -n "$line" ]; do
- apply_line "$line"
- done <<< "$CONFIG_LIST"
|