action.yml 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. name: 'Setup NoMount'
  2. description: 'Integrate NoMount VFS hooks (pinned SHA or latest dev) and enable CONFIG_NOMOUNT'
  3. inputs:
  4. commit:
  5. description: 'Full immutable NoMount commit SHA (empty = latest dev branch tip)'
  6. required: false
  7. default: ''
  8. kernel_version:
  9. description: 'Kernel major/minor version (for example, 5.10 or 6.6)'
  10. required: false
  11. default: ''
  12. outputs:
  13. commit:
  14. description: 'NoMount commit SHA actually integrated'
  15. value: ${{ steps.integrate.outputs.commit }}
  16. runs:
  17. using: composite
  18. steps:
  19. - name: Integrate NoMount
  20. id: integrate
  21. shell: bash
  22. working-directory: ${{ github.workspace }}/kernel
  23. env:
  24. KERNEL_VERSION: ${{ inputs.kernel_version }}
  25. run: |
  26. set -euo pipefail
  27. KERNEL_DIR="${{ github.workspace }}/kernel/common"
  28. test -d "$KERNEL_DIR/fs" || {
  29. echo "Kernel source directory does not exist: $KERNEL_DIR" >&2
  30. exit 1
  31. }
  32. requested_commit="${{ inputs.commit }}"
  33. if [ -z "$requested_commit" ]; then
  34. # Float mode: latest dev branch tip, captured at run time
  35. echo "NoMount: no commit pinned, using latest dev branch tip"
  36. (
  37. cd "$KERNEL_DIR"
  38. curl -fsSL --retry 5 --retry-delay 5 --retry-all-errors \
  39. https://raw.githubusercontent.com/maxsteeel/nomount/refs/heads/dev/kernel/setup.sh | bash -s dev
  40. )
  41. actual_commit="$(git -C "$KERNEL_DIR/NoMount" rev-parse HEAD)"
  42. else
  43. # Pin mode: fetch the setup script at the exact SHA and verify it landed
  44. if ! [[ "$requested_commit" =~ ^[0-9a-f]{40}$ ]]; then
  45. echo "NoMount commit must be a full 40-character SHA." >&2
  46. exit 2
  47. fi
  48. setup_script="${RUNNER_TEMP}/nomount-setup-${requested_commit}.sh"
  49. curl --fail --location --silent --show-error --retry 5 --retry-delay 5 --retry-all-errors \
  50. "https://raw.githubusercontent.com/maxsteeel/nomount/${requested_commit}/kernel/setup.sh" \
  51. --output "$setup_script"
  52. test -s "$setup_script"
  53. chmod 0755 "$setup_script"
  54. (
  55. cd "$KERNEL_DIR"
  56. "$setup_script" "$requested_commit"
  57. )
  58. actual_commit="$(git -C "$KERNEL_DIR/NoMount" rev-parse HEAD)"
  59. if [ "$actual_commit" != "$requested_commit" ]; then
  60. echo "NoMount commit mismatch: expected $requested_commit, got $actual_commit." >&2
  61. exit 1
  62. fi
  63. fi
  64. if [ ! -L "$KERNEL_DIR/fs/nomount" ]; then
  65. echo "NoMount integration failed: fs/nomount symlink missing" >&2
  66. exit 1
  67. fi
  68. echo "commit=$actual_commit" >> "$GITHUB_OUTPUT"
  69. echo "NOMOUNT_COMMIT=$actual_commit" >> "$GITHUB_ENV"
  70. echo "NoMount integrated (kernel $KERNEL_VERSION, commit $actual_commit)"
  71. - name: Enable NoMount in kernel defconfig
  72. uses: ./.github/actions/set-kernel-config
  73. with:
  74. config_list: |
  75. CONFIG_NOMOUNT=y