From 4bc1cee0008bdf8f24ec5e00822d95b28bd9780a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Miotk?= Date: Fri, 4 Nov 2022 16:12:18 +0100 Subject: [PATCH] Fedora Linux v6.0.5 (#74) --- .github/agent-info.sh | 45 ++++++++++++++++ .github/cleanup-runner.sh | 53 +++++++++++++++++++ .github/workflows/build-kernel.yml | 17 +++++- .github/workflows/check-storage.yml | 51 ++++++++++++++++++ README.md | 2 +- build.sh | 18 +++++-- build_in_docker.sh | 6 +-- update_kernel_mbp.sh | 2 +- yum-repo/provision.sh | 1 + .../sources/repo/fedora-mbp-external.repo | 8 +++ yum-repo/{ => sources/repo}/fedora-mbp.gpg | 0 .../mbp-fedora-t2-config.spec} | 2 +- yum-repo/specs/mbp-fedora-t2-repo.spec | 29 ++++++++++ 13 files changed, 221 insertions(+), 13 deletions(-) create mode 100755 .github/agent-info.sh create mode 100755 .github/cleanup-runner.sh create mode 100644 .github/workflows/check-storage.yml create mode 100644 yum-repo/sources/repo/fedora-mbp-external.repo rename yum-repo/{ => sources/repo}/fedora-mbp.gpg (100%) rename yum-repo/{mbp-fedora-t2-config/rpm.spec => specs/mbp-fedora-t2-config.spec} (99%) create mode 100644 yum-repo/specs/mbp-fedora-t2-repo.spec diff --git a/.github/agent-info.sh b/.github/agent-info.sh new file mode 100755 index 0000000..db429b2 --- /dev/null +++ b/.github/agent-info.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env bash + +function info () { + echo >&2 "===]> Info: $* "; +} + +info "Print information about agent..." + +echo -e '\n' +info "uname -a" +uname -a +echo -e '\n' + +info "CPU threads: $(nproc --all)" +info "CPU $(grep 'model name' /proc/cpuinfo | uniq)" +info "CPU freq:" +grep 'MHz' /proc/cpuinfo +echo -e '\n' + +info "Egress Public IP: $(curl -4 -s ifconfig.co)" +echo -e '\n' + +info "pwd" +pwd +echo -e '\n' + +info "df -h" +df -h +echo -e '\n' + +info "free -m" +free -m +echo -e '\n' + +info "w" +w +echo -e '\n' + +info "Top 5 processes sorted by CPU usage..." +ps -Ao user,uid,pid,pcpu,pmem,command,cmd --sort=-pcpu | head -n 6 +echo -e '\n' + +info "Top 5 processes sorted by MEM usage..." +ps -Ao user,uid,pid,pcpu,pmem,command,cmd --sort=-pmem | head -n 6 +echo -e '\n' diff --git a/.github/cleanup-runner.sh b/.github/cleanup-runner.sh new file mode 100755 index 0000000..9340798 --- /dev/null +++ b/.github/cleanup-runner.sh @@ -0,0 +1,53 @@ +#!/usr/bin/env bash + +function info () { + echo >&2 "===]> Info: $* "; +} + +info "Remove unneeded stuff from GitHub Actions Runner..." + + +# 11,2 GiB [###################################] /android +info "Removing Android SDK from /usr/local/lib/android..." +rm -rf /usr/local/lib/android + +# 6,1 GiB [###################################] /hostedtoolcache + +# 2,7 GiB [###################################] /CodeQL +# 1,3 GiB [################# ] /go +# 1,2 GiB [############### ] /Python +# 499,0 MiB [###### ] /PyPy +# 372,6 MiB [#### ] /node +# 60,9 MiB [ ] /Ruby +# 16,0 KiB [ ] /Java_Temurin-Hotspot_jdk + +info "Removing CodeQL..." +rm -rf /opt/hostedtoolcache/CodeQL +info "Removing go..." +rm -rf /opt/hostedtoolcache/go + +# 1,3 GiB [###################################] /jvm + +info "Removing jvm..." +rm -rf /usr/lib/jvm + +# 1,1 GiB [###################################] /powershell + +# rm -rf /usr/local/share/powershell + +# 2,7 GiB [###################################] /dotnet + +info "Removing dotnet core..." +rm -rf /usr/share/dotnet + +# 1,6 GiB [###################################] /swift + +info "Removing swift..." +rm -rf /usr/share/swift + +info "Removing all docker images..." +# shellcheck disable=SC2046 +docker rmi $(docker images | awk '{print $3}') + +info "Cleaning up docker storage..." +docker system prune -f --volumes diff --git a/.github/workflows/build-kernel.yml b/.github/workflows/build-kernel.yml index b6c4b92..18d8e56 100644 --- a/.github/workflows/build-kernel.yml +++ b/.github/workflows/build-kernel.yml @@ -4,9 +4,11 @@ name: Build Fedora Kernel # yamllint disable-line rule:truthy on: [push] +# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#choosing-github-hosted-runners +# https://hub.docker.com/_/alpine jobs: tests: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v2 - name: "YamlLint" @@ -32,10 +34,19 @@ jobs: apk add --no-cache shellcheck bash \ && shellcheck $(find . -type f -name "*.sh" | tr '\n' ' ') " + - name: "AgentInfo" + run: ./.github/agent-info.sh + build: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v2 + - name: "AgentInfo" + run: ./.github/agent-info.sh + - name: "Runner storage cleanup" + run: ./.github/cleanup-runner.sh + - name: "AgentInfo" + run: ./.github/agent-info.sh - name: "Build Fedora Kernel" timeout-minutes: 1200 run: ./build_in_docker.sh @@ -52,3 +63,5 @@ jobs: ./output_zip/* env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # You don't need to add this in secrets it's by default. + - name: "AgentInfo" + run: ./.github/agent-info.sh diff --git a/.github/workflows/check-storage.yml b/.github/workflows/check-storage.yml new file mode 100644 index 0000000..de4f38d --- /dev/null +++ b/.github/workflows/check-storage.yml @@ -0,0 +1,51 @@ +--- +name: Check runner storage + +# yamllint disable-line rule:truthy +on: + workflow_dispatch: + push: + branches: + - master + +# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#choosing-github-hosted-runners +# https://hub.docker.com/_/alpine +jobs: + tests20: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + - name: "AgentInfo before" + run: ./.github/agent-info.sh + - name: "ncdu" + run: | + sudo apt-get update; + sudo apt-get install -y ncdu; + cd / + ncdu -o /tmp/ncdu20.json + - name: Archive ncdu output + uses: actions/upload-artifact@v3 + with: + name: ncdu20-report + path: /tmp/ncdu20.json + - name: "AgentInfo after" + run: ./.github/agent-info.sh + tests22: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v2 + - name: "AgentInfo before" + run: ./.github/agent-info.sh + - name: "ncdu" + run: | + sudo apt-get update; + sudo apt-get install -y ncdu; + cd / + ncdu -o /tmp/ncdu22.json + - name: Archive ncdu output + uses: actions/upload-artifact@v3 + with: + name: ncdu22-report + path: /tmp/ncdu22.json + - name: "AgentInfo after" + run: ./.github/agent-info.sh diff --git a/README.md b/README.md index ed19647..314d610 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ update_kernel_mbp ### Update to specific version of kernel sudo -i -KERNEL_VERSION="6.0-f36" update_kernel_mbp +KERNEL_VERSION="6.0.5-f36" update_kernel_mbp ### Update to specific version of kernel using specific version of update script #### Usually not needed, because scripts are shared between branches, but you can use it to update your update_kernel_mbp script diff --git a/build.sh b/build.sh index c44be6f..d8105fc 100755 --- a/build.sh +++ b/build.sh @@ -73,15 +73,23 @@ rpmbuild -bb --with baseonly --without debug --without debuginfo --target=x86_64 kernel_rpmbuild_exitcode=$? echo >&2 "===]> Info: kernel_rpmbuild_exitcode=$kernel_rpmbuild_exitcode" +echo >&2 "===]> Info: Copy source files for other RPMs ..."; +cp -rfv "${REPO_PWD}"/yum-repo/sources/* ${RPMBUILD_PATH}/SOURCES/ + ### Build non-debug mbp-fedora-t2-config rpm echo >&2 "===]> Info: Bulding non-debug mbp-fedora-t2-config RPM ..."; -cp -rfv "${REPO_PWD}"/yum-repo/mbp-fedora-t2-config/rpm.spec ./ -find . -pwd -rpmbuild -bb --without debug --without debuginfo --target=x86_64 rpm.spec +cp -rfv "${REPO_PWD}"/yum-repo/specs/mbp-fedora-t2-config.spec ./ +rpmbuild -bb --without debug --without debuginfo --target=x86_64 mbp-fedora-t2-config.spec config_rpmbuild_exitcode=$? echo >&2 "===]> Info: mbp-fedora-t2-config config_rpmbuild_exitcode=$config_rpmbuild_exitcode" +### Build non-debug mbp-fedora-t2-repo rpm +echo >&2 "===]> Info: Bulding non-debug mbp-fedora-t2-repo RPM ..."; +cp -rfv "${REPO_PWD}"/yum-repo/specs/mbp-fedora-t2-repo.spec ./ +rpmbuild -bb --without debug --without debuginfo --target=x86_64 mbp-fedora-t2-repo.spec +repo_rpmbuild_exitcode=$? +echo >&2 "===]> Info: mbp-fedora-t2-repo repo_rpmbuild_exitcode=$repo_rpmbuild_exitcode" + ### Import rpm siging key echo >&2 "===]> Info: Importing RPM signing key ..." cat <> ~/.rpmmacros @@ -93,7 +101,7 @@ EOT echo "$RPM_SIGNING_KEY" | base64 -d > ./rpm_signing_key gpg --import ./rpm_signing_key -rpm --import "${REPO_PWD}"/yum-repo/fedora-mbp.gpg +rpm --import "${REPO_PWD}"/yum-repo/sources/repo/fedora-mbp.gpg rm -rfv ./rpm_signing_key rpm --addsign ${RPMBUILD_PATH}/RPMS/x86_64/*.rpm diff --git a/build_in_docker.sh b/build_in_docker.sh index 2fb8861..4fd1173 100755 --- a/build_in_docker.sh +++ b/build_in_docker.sh @@ -5,14 +5,14 @@ set -eu -o pipefail # DOCKER_IMAGE=fedora_build:36 # docker build -t fedora_build:36 . -DOCKER_IMAGE=fedora:36 +DOCKER_IMAGE=${DOCKER_IMAGE:-fedora:36} RPMBUILD_HOST_PATH=~/rpmbuild mkdir -p ${RPMBUILD_HOST_PATH} RPM_SIGNING_KEY=${RPM_SIGNING_KEY:-$(gpg --export-secret-keys -a 'mbp-fedora' | base64)} -# docker pull ${DOCKER_IMAGE} +docker pull "${DOCKER_IMAGE}" docker run \ -t \ --rm \ @@ -20,7 +20,7 @@ docker run \ -v "$(pwd)":/repo \ -v ${RPMBUILD_HOST_PATH}:/root/rpmbuild \ -w /repo \ - ${DOCKER_IMAGE} \ + "${DOCKER_IMAGE}" \ /bin/bash -c './build.sh' # docker run \ diff --git a/update_kernel_mbp.sh b/update_kernel_mbp.sh index 28d95ba..c569ccf 100755 --- a/update_kernel_mbp.sh +++ b/update_kernel_mbp.sh @@ -79,7 +79,7 @@ if rpm -q gpg-pubkey --qf '%{SUMMARY}\n' | grep -q -i mbp-fedora; then echo >&2 "===]> Info: fedora-mbp yum repo gpg key is already added, skipping..."; else echo >&2 "===]> Info: Adding fedora-mbp yum repo gpg key..."; - curl -sSL "https://raw.githubusercontent.com/mikeeq/mbp-fedora-kernel/${UPDATE_SCRIPT_BRANCH}/yum-repo/fedora-mbp.gpg" > ./fedora-mbp.gpg + curl -sSL "https://raw.githubusercontent.com/mikeeq/mbp-fedora-kernel/${UPDATE_SCRIPT_BRANCH}/yum-repo/sources/repo/fedora-mbp.gpg" > ./fedora-mbp.gpg rpm --import ./fedora-mbp.gpg rm -rf ./fedora-mbp.gpg fi diff --git a/yum-repo/provision.sh b/yum-repo/provision.sh index 1c2ee0c..ea951f8 100755 --- a/yum-repo/provision.sh +++ b/yum-repo/provision.sh @@ -9,6 +9,7 @@ cd /var/repo # mv -f ./fedora-mbp-repo.herokuapp.com/*.rpm ./ # rm -rfv fedora-mbp-repo.herokuapp.com + ### Download older version of shim ## shim 15.4-4 or -5 is not working on MBP 16,2 # https://koji.fedoraproject.org/koji/packageinfo?packageID=14502 diff --git a/yum-repo/sources/repo/fedora-mbp-external.repo b/yum-repo/sources/repo/fedora-mbp-external.repo new file mode 100644 index 0000000..a805952 --- /dev/null +++ b/yum-repo/sources/repo/fedora-mbp-external.repo @@ -0,0 +1,8 @@ +[fedora-mbp] +name=Fedora MBP +baseurl=https://fedora-mbp-repo.herokuapp.com/ +gpgcheck=1 +enabled=1 +cost=998 +priority=98 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-mbp diff --git a/yum-repo/fedora-mbp.gpg b/yum-repo/sources/repo/fedora-mbp.gpg similarity index 100% rename from yum-repo/fedora-mbp.gpg rename to yum-repo/sources/repo/fedora-mbp.gpg diff --git a/yum-repo/mbp-fedora-t2-config/rpm.spec b/yum-repo/specs/mbp-fedora-t2-config.spec similarity index 99% rename from yum-repo/mbp-fedora-t2-config/rpm.spec rename to yum-repo/specs/mbp-fedora-t2-config.spec index 1835ab5..eaef030 100644 --- a/yum-repo/mbp-fedora-t2-config/rpm.spec +++ b/yum-repo/specs/mbp-fedora-t2-config.spec @@ -1,6 +1,6 @@ Name: mbp-fedora-t2-config Version: 6.0.5 -Release: 1%{?dist} +Release: 2%{?dist} Summary: System configuration for mbp-fedora on Apple T2 Macs. %undefine _disable_source_fetch diff --git a/yum-repo/specs/mbp-fedora-t2-repo.spec b/yum-repo/specs/mbp-fedora-t2-repo.spec new file mode 100644 index 0000000..2918b09 --- /dev/null +++ b/yum-repo/specs/mbp-fedora-t2-repo.spec @@ -0,0 +1,29 @@ +Name: mbp-fedora-t2-repo +Version: 1.0.0 +Release: 1%{?dist} +Summary: RPM repo for mbp-fedora on Apple T2 Macs. + +%undefine _disable_source_fetch + +License: GPLv2+ +URL: https://github.com/mikeeq/mbp-fedora + +%description +RPM repo with packages for mbp-fedora on Apple T2 Macs. + +%prep +cp -rf %{_sourcedir}/repo %{_builddir}/ + +%build + +%install +mkdir -p %{buildroot}/etc/pki/rpm-gpg +mv %{_builddir}/repo/fedora-mbp.gpg %{buildroot}/etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-mbp + +mkdir -p %{buildroot}/etc/yum.repos.d +mv %{_builddir}/repo/fedora-mbp-external.repo %{buildroot}/etc/yum.repos.d/fedora-mbp.repo + + +%files +/etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-mbp +/etc/yum.repos.d/fedora-mbp.repo