From 8cd4fbe2c952d1d09d6c92c87e02b3a7ec9f4ec5 Mon Sep 17 00:00:00 2001 From: Fermin Gallego Date: Wed, 6 Jan 2021 12:32:03 +0100 Subject: [PATCH 1/6] Create rtl88x2bu-dkms-mkrpm.spec --- .github/workflows/rtl88x2bu-dkms-mkrpm.spec | 84 +++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 .github/workflows/rtl88x2bu-dkms-mkrpm.spec diff --git a/.github/workflows/rtl88x2bu-dkms-mkrpm.spec b/.github/workflows/rtl88x2bu-dkms-mkrpm.spec new file mode 100644 index 0000000..1f8feeb --- /dev/null +++ b/.github/workflows/rtl88x2bu-dkms-mkrpm.spec @@ -0,0 +1,84 @@ +%{?!module_name: %{error: You did not specify a module name (%%module_name)}} +%{?!version: %{error: You did not specify a module version (%%version)}} +%{?!kernel_versions: %{error: You did not specify kernel versions (%%kernel_version)}} +%{?!packager: %define packager DKMS } +%{?!license: %define license Unknown} +%{?!_dkmsdir: %define _dkmsdir /var/lib/dkms} +%{?!_srcdir: %define _srcdir %_prefix/src} +%{?!_datarootdir: %define _datarootdir %{_datadir}} + +Summary: %{module_name} %{version} dkms package +Name: %{module_name} +Version: %{version} +License: %license +Release: 1dkms +BuildArch: noarch +Group: System/Kernel +Requires: dkms >= 1.95 +# -- Building dkms-rpm from ubuntu, turn off checking requirements (find-requires and find-provides), manually added in Requires +Autoprov: 0 +#BuildRequires: dkms +# -- +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root/ + +%description +Kernel modules for %{module_name} %{version} in a DKMS wrapper. + +%prep +if [ "%mktarball_line" != "none" ]; then + /usr/sbin/dkms mktarball -m %module_name -v %version %mktarball_line --archive `basename %{module_name}-%{version}.dkms.tar.gz` + cp -af %{_dkmsdir}/%{module_name}/%{version}/tarball/`basename %{module_name}-%{version}.dkms.tar.gz` %{module_name}-%{version}.dkms.tar.gz +fi + +%install +if [ "$RPM_BUILD_ROOT" != "/" ]; then + rm -rf $RPM_BUILD_ROOT +fi +mkdir -p $RPM_BUILD_ROOT/%{_srcdir} +mkdir -p $RPM_BUILD_ROOT/%{_datarootdir}/%{module_name} + +if [ -d %{_sourcedir}/%{module_name}-%{version} ]; then + cp -Lpr %{_sourcedir}/%{module_name}-%{version} $RPM_BUILD_ROOT/%{_srcdir} +fi + +if [ -f %{module_name}-%{version}.dkms.tar.gz ]; then + install -m 644 %{module_name}-%{version}.dkms.tar.gz $RPM_BUILD_ROOT/%{_datarootdir}/%{module_name} +fi + +if [ -f %{_sourcedir}/common.postinst ]; then + install -m 755 %{_sourcedir}/common.postinst $RPM_BUILD_ROOT/%{_datarootdir}/%{module_name}/postinst +fi + +%clean +if [ "$RPM_BUILD_ROOT" != "/" ]; then + rm -rf $RPM_BUILD_ROOT +fi + +%post +for POSTINST in %{_prefix}/lib/dkms/common.postinst %{_datarootdir}/%{module_name}/postinst; do + if [ -f $POSTINST ]; then + $POSTINST %{module_name} %{version} %{_datarootdir}/%{module_name} + exit $? + fi + echo "WARNING: $POSTINST does not exist." +done +echo -e "ERROR: DKMS version is too old and %{module_name} was not" +echo -e "built with legacy DKMS support." +echo -e "You must either rebuild %{module_name} with legacy postinst" +echo -e "support or upgrade DKMS to a more current version." +exit 1 + +%preun +echo -e +echo -e "Uninstall of %{module_name} module (version %{version}) beginning:" +dkms remove -m %{module_name} -v %{version} --all --rpm_safe_upgrade +exit 0 + +%files +%defattr(-,root,root) +%{_srcdir} +%{_datarootdir}/%{module_name}/ + +%changelog +* %(date "+%a %b %d %Y") %packager %{version}-%{release} +- Automatic build by DKMS From c721c740996cd981385c2f12fa004a6131ea3c7d Mon Sep 17 00:00:00 2001 From: Fermin Gallego Date: Wed, 6 Jan 2021 12:40:56 +0100 Subject: [PATCH 2/6] Create tag-and-release.yml --- .github/workflows/tag-and-release.yml | 51 +++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/tag-and-release.yml diff --git a/.github/workflows/tag-and-release.yml b/.github/workflows/tag-and-release.yml new file mode 100644 index 0000000..3a1b215 --- /dev/null +++ b/.github/workflows/tag-and-release.yml @@ -0,0 +1,51 @@ +# This is a basic workflow to help you get started with Actions + +name: CI + +# Controls when the action will run. +on: + # Triggers the workflow on push or pull request events but only for any tag + push: + tags: [ '**' ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + + # Installs dependencies to build the package + - name: Install dependencies + run: sudo apt install dkms debhelper rpm + + # Runs a set of commands using the runners shell + - name: Run a multi-line script + run: | + VER=$(sed -n 's/\PACKAGE_VERSION="\(.*\)"/\1/p' dkms.conf) + sudo rsync -rvhP ./ /usr/src/rtl88x2bu-${VER} + sudo dkms add -m rtl88x2bu -v ${VER} + sudo dkms build -m rtl88x2bu -v ${VER} + sudo dkms mkdeb -m rtl88x2bu -v ${VER} + sudo dkms mkrpm -m rtl88x2bu -v ${VER} + + # Creates a release draft with the attached package + - name: Create release draft + uses: softprops/action-gh-release@v1 + with: + tag_name: ${{ github.ref }} + name: Release ${{ github.ref }} + draft: true + files: | + /var/lib/dkms/rtl88x2bu/*/deb/rtl88x2bu-dkms*.deb + /var/lib/dkms/rtl88x2bu/*/rpm/rtl88x2bu-*.rpm + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 82a44d972a973b174afd775f48969ef6ef641182 Mon Sep 17 00:00:00 2001 From: Fermin Gallego Date: Wed, 6 Jan 2021 12:42:13 +0100 Subject: [PATCH 3/6] Update tag-and-release.yml --- .github/workflows/tag-and-release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tag-and-release.yml b/.github/workflows/tag-and-release.yml index 3a1b215..d896210 100644 --- a/.github/workflows/tag-and-release.yml +++ b/.github/workflows/tag-and-release.yml @@ -31,6 +31,7 @@ jobs: - name: Run a multi-line script run: | VER=$(sed -n 's/\PACKAGE_VERSION="\(.*\)"/\1/p' dkms.conf) + cp .github/workflows/rtl88x2bu-dkms-mkrpm.spec ./ sudo rsync -rvhP ./ /usr/src/rtl88x2bu-${VER} sudo dkms add -m rtl88x2bu -v ${VER} sudo dkms build -m rtl88x2bu -v ${VER} From 88da42f28d50e10d5fc4fa592a03155fbafe20fc Mon Sep 17 00:00:00 2001 From: Fermin Gallego Date: Wed, 6 Jan 2021 13:02:13 +0100 Subject: [PATCH 4/6] Update tag-and-release.yml --- .github/workflows/tag-and-release.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tag-and-release.yml b/.github/workflows/tag-and-release.yml index d896210..7747bcf 100644 --- a/.github/workflows/tag-and-release.yml +++ b/.github/workflows/tag-and-release.yml @@ -23,6 +23,10 @@ jobs: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v2 + # Gets tags name + - name: Set env + run: echo "TAG_NAME=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + # Installs dependencies to build the package - name: Install dependencies run: sudo apt install dkms debhelper rpm @@ -42,8 +46,8 @@ jobs: - name: Create release draft uses: softprops/action-gh-release@v1 with: - tag_name: ${{ github.ref }} - name: Release ${{ github.ref }} + tag_name: ${{ env.TAG_NAME }} + name: ${{ env.TAG_NAME }} draft: true files: | /var/lib/dkms/rtl88x2bu/*/deb/rtl88x2bu-dkms*.deb From 3c63327ed55aceeef4ee782903f1b13c4dc4acef Mon Sep 17 00:00:00 2001 From: Fermin Gallego Date: Wed, 6 Jan 2021 13:36:39 +0100 Subject: [PATCH 5/6] Update tag-and-release.yml --- .github/workflows/tag-and-release.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tag-and-release.yml b/.github/workflows/tag-and-release.yml index 7747bcf..5bc87f8 100644 --- a/.github/workflows/tag-and-release.yml +++ b/.github/workflows/tag-and-release.yml @@ -36,11 +36,11 @@ jobs: run: | VER=$(sed -n 's/\PACKAGE_VERSION="\(.*\)"/\1/p' dkms.conf) cp .github/workflows/rtl88x2bu-dkms-mkrpm.spec ./ - sudo rsync -rvhP ./ /usr/src/rtl88x2bu-${VER} + sudo rsync --exclude '.git' -rvhP ./ /usr/src/rtl88x2bu-${VER} sudo dkms add -m rtl88x2bu -v ${VER} sudo dkms build -m rtl88x2bu -v ${VER} - sudo dkms mkdeb -m rtl88x2bu -v ${VER} - sudo dkms mkrpm -m rtl88x2bu -v ${VER} + sudo dkms mkdeb -m rtl88x2bu -v ${VER} --source-only + sudo dkms mkrpm -m rtl88x2bu -v ${VER} --source-only # Creates a release draft with the attached package - name: Create release draft @@ -50,7 +50,7 @@ jobs: name: ${{ env.TAG_NAME }} draft: true files: | - /var/lib/dkms/rtl88x2bu/*/deb/rtl88x2bu-dkms*.deb + /var/lib/dkms/rtl88x2bu/*/deb/rtl88x2bu-*.deb /var/lib/dkms/rtl88x2bu/*/rpm/rtl88x2bu-*.rpm env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 627061b2d7ee24de60bfa4bbc1a5b79f0b1545b9 Mon Sep 17 00:00:00 2001 From: Fermin Gallego Date: Wed, 6 Jan 2021 13:54:26 +0100 Subject: [PATCH 6/6] Update rtl88x2bu-dkms-mkrpm.spec --- .github/workflows/rtl88x2bu-dkms-mkrpm.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rtl88x2bu-dkms-mkrpm.spec b/.github/workflows/rtl88x2bu-dkms-mkrpm.spec index 1f8feeb..378e29e 100644 --- a/.github/workflows/rtl88x2bu-dkms-mkrpm.spec +++ b/.github/workflows/rtl88x2bu-dkms-mkrpm.spec @@ -14,7 +14,7 @@ License: %license Release: 1dkms BuildArch: noarch Group: System/Kernel -Requires: dkms >= 1.95 +Requires: dkms >= 1.95, kernel-devel # -- Building dkms-rpm from ubuntu, turn off checking requirements (find-requires and find-provides), manually added in Requires Autoprov: 0 #BuildRequires: dkms