Update elrepo config #785
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# This is free software, licensed under the MIT License. | |
# See /LICENSE for more information. | |
# | |
# Description: Build Kernel using GitHub Actions | |
# | |
name: Update elrepo config | |
on: | |
workflow_dispatch: | |
env: | |
TZ: Asia/Shanghai | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
fetch-depth: 0 | |
- name: Initialize environment | |
run: | | |
sudo -E sed -i~orig -e 's/# deb-src/deb-src/' /etc/apt/sources.list | |
sudo -E apt-get -qq update | |
sudo -E apt-get -qq install bzip2 gawk git unzip htop wget curl -y | |
sudo timedatectl set-timezone "$TZ" | |
sudo mkdir -p /workdir/upload | |
sudo chown $USER:$GROUPS /workdir /workdir/upload | |
- name: Check for updates | |
id: check | |
run: | | |
config_path=/home/runner/work/kernel/kernel/config_elrepo | |
action_kernel_ver=$(grep "Linux/x86_64" $config_path | awk -F '[- ]' '{print $3}') | |
kernel_ver=$(curl -s 'https://elrepo.org/linux/kernel/el7/x86_64/RPMS/?C=N;O=D' | grep -oP 'kernel-ml-headers[^"]+' | head -n 1 | awk -F '-' '{print $4}') | |
echo "action_kernel_ver=$action_kernel_ver" | |
echo "kernel_ver=$kernel_ver" | |
if [[ "${action_kernel_ver}" == *"${kernel_ver}"* ]]; then | |
echo "check.status=fail" >> $GITHUB_ENV | |
else | |
echo "check.status=success" >> $GITHUB_ENV | |
fi | |
- name: Update config | |
id: update | |
if: ${{ env.check.status }} == 'success' | |
working-directory: /workdir | |
run: | | |
sudo apt-get -qq install -y rpm2cpio | |
elrepo_c7_ver=$(curl -s 'https://elrepo.org/linux/kernel/el7/x86_64/RPMS/?C=N;O=D' | grep -oP 'kernel-ml-headers[^"]+' | head -n 1 | awk -F '-' '{print $4}') | |
sudo wget https://elrepo.org/linux/kernel/el7/x86_64/RPMS/kernel-ml-$elrepo_c7_ver-1.el7.elrepo.x86_64.rpm | |
sudo rpm2cpio kernel-ml-$elrepo_c7_ver-1.el7.elrepo.x86_64.rpm | cpio -divm | |
cd /workdir/boot | |
config=/home/runner/work/kernel/kernel/config_elrepo | |
elrepo_patch=/home/runner/work/kernel/kernel/elrepo_config.patch | |
sudo rm -rf $config | |
sudo mv config-*-1.el7.elrepo.x86_64 $config | |
sudo sed -ri 's/.*CONFIG_TCP_CONG_CUBIC.*/CONFIG_TCP_CONG_CUBIC=m/' ${config} | |
sudo sed -ri 's/.*CONFIG_TCP_CONG_BBR.*/CONFIG_TCP_CONG_BBR=y/' ${config} | |
sudo sed -ri '/.*CONFIG_DEFAULT_CUBIC.*/i\CONFIG_TCP_CONG_BBR2=m' ${config} | |
sudo sed -ri '/CONFIG_TCP_CONG_BBR2=m/a CONFIG_TCP_CONG_BBR3=m' ${config} | |
sudo sed -ri 's/.*CONFIG_DEFAULT_TCP_CONG.*/CONFIG_DEFAULT_TCP_CONG="bbr"/' ${config} | |
sudo sed -ri 's/.*CONFIG_NET_SCH_PIE.*/CONFIG_NET_SCH_PIE=y/' ${config} | |
sudo sed -ri 's/.*CONFIG_NET_SCH_FQ_PIE.*/CONFIG_NET_SCH_FQ_PIE=y/' ${config} | |
sudo sed -ri 's/.*CONFIG_NET_SCH_DEFAULT.*/CONFIG_NET_SCH_DEFAULT=y/' ${config} | |
sudo sed -ri '/.*CONFIG_NET_SCH_FQ_PIE.*/i\CONFIG_DEFAULT_FQ_PIE=y' ${config} | |
sudo sed -ri '/.*CONFIG_DEFAULT_FQ_PIE.*/i\CONFIG_DEFAULT_NET_SCH="fq_pie"' ${config} | |
sudo sed -ri '/CONFIG_XEN_BLKDEV_FRONTEND/s/=.+/=y/g' ${config} | |
sudo sed -ri '/CONFIG_XEN_NETDEV_FRONTEND/s/=.+/=y/g' ${config} | |
sudo sed -ri '/CONFIG_VIRTIO_BLK/s/=.+/=y/g' ${config} | |
sudo sed -ri '/CONFIG_VIRTIO_NET/s/=.+/=y/g' ${config} | |
sudo sed -ri '/CONFIG_TLS/s/=.+/=y/g' ${config} | |
sudo sed -ri '/CONFIG_TLS_DEVICE/s/=.+/=y/g' ${config} | |
#sudo sed -ri '/CONFIG_MPTCP*/c\CONFIG_MPTCP=y' ${config} | |
#sudo sed -i 's/.*CONFIG_KERNEL_ZSTD.*/CONFIG_KERNEL_ZSTD=n/' ${config} | |
#sudo sed -i 's/.*CONFIG_KERNEL_ZSTD.*/CONFIG_KERNEL_ZSTD=n/' ${config} | |
#sudo sed -i 's/.*CONFIG_RD_ZSTD.*/CONFIG_RD_ZSTD=n/' ${config} | |
#sudo sed -i 's/.*CONFIG_MODULE_COMPRESS_ZSTD.*/CONFIG_MODULE_COMPRESS_ZSTD=n/' ${config} | |
#sudo sed -i 's/.*ZSWAP_COMPRESSOR_DEFAULT_ZSTD.*/ZSWAP_COMPRESSOR_DEFAULT_ZSTD=n/' ${config} | |
#sudo sed -i 's/.*CONFIG_CRYPTO_ZSTD.*/CONFIG_CRYPTO_ZSTD=n/' ${config} | |
#sudo sed -i 's/.*CONFIG_F2FS_FS_ZSTD.*/CONFIG_F2FS_FS_ZSTD=n/' ${config} | |
sudo sed -ri '/.*CONFIG_DEFAULT_RENO.*/d' ${config} | |
sudo sed -ri '/.*CONFIG_DEFAULT_CUBIC.*/d' ${config} | |
sudo sed -ri '/.*CONFIG_DEFAULT_FQ.*/d' ${config} | |
sudo sed -ri '/.*CONFIG_DEFAULT_CODEL.*/d' ${config} | |
sudo sed -ri '/.*CONFIG_DEFAULT_FQ_CODEL.*/d' ${config} | |
sudo sed -ri '/.*CONFIG_DEFAULT_SFQ.*/d' ${config} | |
sudo sed -ri '/.*CONFIG_DEFAULT_PFIFO_FAST.*/d' ${config} | |
sudo sed -ri '/CONFIG_HAVE_ARCH_KCSAN*/c\# CONFIG_HAVE_ARCH_KCSAN is not set' ${config} | |
sudo sed -ri '/CONFIG_DEBUG_INFO_NONE*/c\# CONFIG_DEBUG_INFO_NONE is not set' ${config} | |
sudo sed -ri '/CONFIG_MODULE_SIG=y/c\# CONFIG_MODULE_SIG is not set' ${config} | |
sudo sed -ri '/CONFIG_MODULE_SIG_ALL*/c\# CONFIG_MODULE_SIG_ALL is not set' ${config} | |
sudo sed -ri '/CONFIG_DEBUG_INFO=*/c\# CONFIG_DEBUG_INFO is not set' ${config} | |
sudo sed -ri '/CONFIG_DEBUG_INFO_NONE*/c\# CONFIG_DEBUG_INFO_NONE is not set' ${config} | |
sudo sed -ri '/CONFIG_DEBUG_INFO_DWARF4*/c\# CONFIG_DEBUG_INFO_DWARF4 is not set' ${config} | |
sudo sed -ri '/CONFIG_DEBUG_INFO_BTF*/c\# CONFIG_DEBUG_INFO_BTF is not set' ${config} | |
sudo sed -ri '/CONFIG_DEBUG_INFO_DWARF5*/c\# CONFIG_DEBUG_INFO_DWARF5 is not set' ${config} | |
sudo sed -ri '/CONFIG_MODULE_SIG_KEY_TYPE_RSA*/c\# CONFIG_MODULE_SIG_KEY_TYPE_RSA is not set' ${config} | |
sudo sed -ri '/CONFIG_MODULE_SIG_KEY=*/c\CONFIG_MODULE_SIG_KEY=""' ${config} | |
sudo sed -ri '/CONFIG_SYSTEM_TRUSTED_KEYS=*/c\CONFIG_SYSTEM_TRUSTED_KEYS=""' ${config} | |
echo "update.status=success" >> $GITHUB_ENV | |
- name: Commit files | |
continue-on-error: true | |
if: ${{ env.update.status }} == 'success' | |
run: | | |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git commit -m "Add changes" -a | |
- name: Push changes | |
continue-on-error: true | |
if: ${{ env.update.status }} == 'success' | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.TOKEN }} | |
branch: ${{ github.ref }} | |
- name: Delete workflow runs | |
uses: GitRML/delete-workflow-runs@main | |
with: | |
token: ${{ secrets.TOKEN }} | |
retain_days: 1 | |
keep_minimum_runs: 1 |