Skip to content

Commit

Permalink
Fedora Linux v6.0.5 (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeeq authored Nov 4, 2022
1 parent 45567ed commit 4bc1cee
Show file tree
Hide file tree
Showing 13 changed files with 221 additions and 13 deletions.
45 changes: 45 additions & 0 deletions .github/agent-info.sh
Original file line number Diff line number Diff line change
@@ -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'
53 changes: 53 additions & 0 deletions .github/cleanup-runner.sh
Original file line number Diff line number Diff line change
@@ -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
17 changes: 15 additions & 2 deletions .github/workflows/build-kernel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand All @@ -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
51 changes: 51 additions & 0 deletions .github/workflows/check-storage.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 13 additions & 5 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 <<EOT >> ~/.rpmmacros
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions build_in_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@ 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 \
-e RPM_SIGNING_KEY="$RPM_SIGNING_KEY" \
-v "$(pwd)":/repo \
-v ${RPMBUILD_HOST_PATH}:/root/rpmbuild \
-w /repo \
${DOCKER_IMAGE} \
"${DOCKER_IMAGE}" \
/bin/bash -c './build.sh'

# docker run \
Expand Down
2 changes: 1 addition & 1 deletion update_kernel_mbp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions yum-repo/provision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions yum-repo/sources/repo/fedora-mbp-external.repo
Original file line number Diff line number Diff line change
@@ -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
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -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
Expand Down
29 changes: 29 additions & 0 deletions yum-repo/specs/mbp-fedora-t2-repo.spec
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 4bc1cee

Please sign in to comment.