-
Notifications
You must be signed in to change notification settings - Fork 1
/
action.yml
57 lines (50 loc) · 1.85 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Copyright (c) 2022 OpenFaaS Ltd
name: 'get-kernel-sources'
description: 'Download the Kernel source to build a kmod or dmks in actuated'
branding:
icon: 'arrow-right-circle'
color: 'gray-dark'
inputs:
cache:
description: Whether to enable caching for the downloaded sources
required: false
default: 'true'
runs:
using: 'composite'
steps:
- name: Install git if not present
shell: bash
run: |
if ! [ -x "$(command -v git)" ]; then
echo Installing git
sudo apt update -qqqy && sudo apt install -qqqy git
fi
- name: Reset permissions of /usr/src for runner
shell: bash
run: |
sudo chown -R runner:docker /usr/src
- name: Store KERNEL_RELEASE
shell: bash
run: |
echo "KERNEL_RELEASE=$(uname -r)" >> $GITHUB_ENV
- name: Cache Kernel sources
if: inputs.cache == 'true'
id: cache-kernel-sources
uses: actions/cache@v4
with:
path: |
/usr/src/linux
key: ${{ runner.os }}-${{ runner.arch }}-${{env.KERNEL_RELEASE}}
- name: Clone Kernel sources and link to /usr/src/linux
shell: bash
if: ${{ steps.cache-kernel-sources.outputs.cache-hit != 'true' }}
run: |
sudo mkdir -p /usr/src
sudo git clone --depth 1 --branch v$KERNEL_RELEASE git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git /usr/src/linux
- name: Create proper symlinks
shell: bash
run: |
sudo rm /lib/modules/$KERNEL_RELEASE/build
sudo ln -s /usr/src/linux-headers-$KERNEL_RELEASE/ /lib/modules/$KERNEL_RELEASE/build
sudo rm /lib/modules/$KERNEL_RELEASE/source
sudo ln -s /usr/src/linux-headers-$KERNEL_RELEASE/ /lib/modules/$KERNEL_RELEASE/source