| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- name: Setup Wild KSU
- description: Download and configure Wild KSU with version tracking
- inputs:
- ksu_commit:
- description: "KernelSU-Next ref/commit (optional, defaults to dev)"
- required: false
- type: string
- default: ""
- runs:
- using: composite
- steps:
- - name: Download Wild KSU
- shell: bash
- working-directory: ${{ github.workspace }}/kernel
- run: |
- set -euo pipefail
- TARGET_REF="${{ inputs.ksu_commit }}"
- if [ -z "$TARGET_REF" ]; then TARGET_REF="dev"; fi
- curl -LSs "https://raw.githubusercontent.com/KernelSU-Next/KernelSU-Next/dev/kernel/setup.sh" | bash -s dev
- if [ "$TARGET_REF" != "dev" ]; then
- cd KernelSU-Next
- if git rev-parse --is-shallow-repository >/dev/null 2>&1 && git rev-parse --is-shallow-repository | grep -q true; then
- git fetch --unshallow --tags --prune || true
- fi
- git fetch --all --tags --prune
- if git checkout "$TARGET_REF" 2>/dev/null; then
- :
- elif git checkout "origin/$TARGET_REF" 2>/dev/null; then
- :
- elif git checkout "refs/tags/$TARGET_REF" 2>/dev/null; then
- :
- else
- echo "Error: could not checkout KernelSU-Next ref/commit/tag: $TARGET_REF"
- exit 1
- fi
- cd "$GITHUB_WORKSPACE/kernel"
- fi
-
- cd KernelSU-Next/kernel
-
- COMMITS_COUNT=$(/usr/bin/git rev-list --count HEAD)
- BASE_VERSION=30000
- KSU_VERSION=$(expr $COMMITS_COUNT "+" $BASE_VERSION)
- sed -i "s/^KSU_VERSION_FALLBACK := 1$/KSU_VERSION_FALLBACK := ${KSU_VERSION}/" Kbuild
- KSU_GIT_TAG="$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.1")"
- sed -i "s/^KSU_VERSION_TAG_FALLBACK := v0.0.1$/KSU_VERSION_TAG_FALLBACK := ${KSU_GIT_TAG}/" Kbuild
- - name: Enable KernelSU Config
- shell: bash
- working-directory: ${{ github.workspace }}/kernel
- run: |
- cat >> "${{ github.workspace }}/wild_gki.fragment" << 'EOF'
- # KernelSU Configuration
- CONFIG_KSU=y
- EOF
-
- - name: Extract KSU Version Info
- id: ksu-version
- shell: bash
- working-directory: ${{ github.workspace }}/kernel/KernelSU-Next
- run: |
- # Extract and export KSU version info
- KSU_GIT_VERSION=$(git rev-list --count HEAD 2>/dev/null)
- KSU_GIT_TAG=$(git describe --tags --abbrev=0 2>/dev/null)
- KSU_COMMIT=$(git rev-parse --short HEAD 2>/dev/null)
- KSU_VERSION=$((30000 + KSU_GIT_VERSION))
-
- echo "KSU_GIT_TAG=$KSU_GIT_TAG" >> $GITHUB_ENV
- echo "KSU_VERSION=$KSU_VERSION" >> $GITHUB_ENV
- echo "KSU_COMMIT=$KSU_COMMIT" >> $GITHUB_ENV
|