Add script for automatic updates
This change adds a script to automate the updating of the repository to a new Linux kernel release.
This commit is contained in:
parent
bc5cd8b02a
commit
c5d857229c
4 changed files with 165 additions and 2 deletions
4
.github/workflows/release.yml
vendored
4
.github/workflows/release.yml
vendored
|
@ -6,6 +6,7 @@ on:
|
|||
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
runs-on: [self-hosted, build]
|
||||
strategy:
|
||||
matrix:
|
||||
|
@ -43,6 +44,7 @@ jobs:
|
|||
name: debs-${{ matrix.build_type }}
|
||||
path: "*.deb"
|
||||
publish:
|
||||
name: Publish
|
||||
runs-on: [self-hosted]
|
||||
needs: build
|
||||
steps:
|
||||
|
@ -68,7 +70,7 @@ jobs:
|
|||
- name: Create Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
name: pve-edge-kernel ${{ steps.format_release.outputs.release }}
|
||||
body: ${{ steps.format_release.outputs.changelog }}
|
||||
|
|
3
Makefile
3
Makefile
|
@ -157,4 +157,5 @@ abi-tmp-${KVNAME}:
|
|||
.PHONY: clean
|
||||
clean:
|
||||
rm -rf *~ build *.prepared ${KERNEL_CFG_ORG}
|
||||
rm -f *.deb *.changes *.buildinfo release.txt artifacts.txt
|
||||
rm -f *.deb *.ddeb *.changes *.buildinfo release.txt artifacts.txt
|
||||
rm -f debian/control debian/pve-edge-*.postinst debian/pve-edge-*.prerm debian/pve-edge-*.postrm debian/rules.d/env.mk
|
||||
|
|
92
scripts/update.sh
Executable file
92
scripts/update.sh
Executable file
|
@ -0,0 +1,92 @@
|
|||
#1/bin/bash
|
||||
# Script to prepare update for new kernel release
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
LINUX_REPOSITORY=submodules/ubuntu-mainline
|
||||
|
||||
while getopts "r:t:b:v:h" OPTION; do
|
||||
case $OPTION in
|
||||
r)
|
||||
LINUX_REPOSITORY=$OPTARG
|
||||
;;
|
||||
t)
|
||||
LINUX_TAG=$OPTARG
|
||||
;;
|
||||
b)
|
||||
LINUX_BASE=$OPTARG
|
||||
;;
|
||||
v)
|
||||
LINUX_VERSION=$OPTARG
|
||||
;;
|
||||
|
||||
h)
|
||||
echo "update.sh -rtbh"
|
||||
echo " -r path to Linux Git repository"
|
||||
echo " -t tag in Linux Git repository to pick"
|
||||
echo " -b manual basis for this kernel"
|
||||
echo " -v manual version for this kernel"
|
||||
echo " -h this help message"
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
echo "Incorrect options provided"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Fetch from Git repository
|
||||
echo "Fetching $LINUX_TAG from Linux Git repository..."
|
||||
|
||||
git --git-dir $LINUX_REPOSITORY/.git fetch origin --depth 1 $LINUX_TAG
|
||||
git --git-dir $LINUX_REPOSITORY/.git checkout FETCH_HEAD
|
||||
|
||||
if [[ -z "$LINUX_BASE" ]]; then
|
||||
# Parse the Ubuntu base from which our build is derived
|
||||
UBUNTU_BASE=$(git --git-dir $LINUX_REPOSITORY/.git log -1 --pretty=%B | sed -n "s/^.*Ubuntu-\([0-9.-]*\).*$/\1/p")
|
||||
LINUX_BASE="Ubuntu $UBUNTU_BASE"
|
||||
fi
|
||||
|
||||
if [[ -z "$LINUX_VERSION" ]]; then
|
||||
# Parse the Linux version from the Linux repository if it not provided by the user
|
||||
LINUX_VERSION=$(dpkg-parsechangelog -l $LINUX_REPOSITORY/debian.master/changelog --show-field Version | sed -n "s/^\([0-9.]*\).*$/\1/p")
|
||||
fi
|
||||
|
||||
echo "Using Linux $LINUX_VERSION based on $LINUX_BASE."
|
||||
|
||||
# Prepare Debian changelog
|
||||
sed -e "s/@KVNAME@/$LINUX_VERSION/g" -e "s/@KVMAJMIN@/$LINUX_VERSION_MAJOR.$LINUX_VERSION_MINOR/g" < debian/control.in > debian/control
|
||||
|
||||
LINUX_VERSION_MAJOR=$(echo $LINUX_VERSION | cut -d. -f1)
|
||||
LINUX_VERSION_MINOR=$(echo $LINUX_VERSION | cut -d. -f2)
|
||||
LINUX_VERSION_PATCH=$(echo $LINUX_VERSION | cut -d. -f3)
|
||||
LINUX_VERSION_PATCH=${LINUX_VERSION_PATCH:-0} # Default to 0
|
||||
|
||||
LINUX_PACKAGE_RELEASE_PREVIOUS=$(scripts/version.sh -r)
|
||||
|
||||
# Check whether we need to increment the package release
|
||||
if [[ $LINUX_VERSION == "$(scripts/version.sh -L)" ]]; then
|
||||
LINUX_PACKAGE_RELEASE=$((LINUX_PACKAGE_RELEASE_PREVIOUS + 1))
|
||||
echo "Incrementing package release to $LINUX_PACKAGE_RELEASE"
|
||||
else
|
||||
LINUX_PACKAGE_RELEASE=1
|
||||
echo "New package release"
|
||||
fi
|
||||
|
||||
echo "Updating Makefile..."
|
||||
# Update the Makefile with the proper version numbers
|
||||
sed -i Makefile \
|
||||
-e "s/^KERNEL_MAJ=[0-9]*$/KERNEL_MAJ=$LINUX_VERSION_MAJOR/" \
|
||||
-e "s/^KERNEL_MIN=[0-9]*$/KERNEL_MIN=$LINUX_VERSION_MINOR/" \
|
||||
-e "s/^KERNEL_PATCHLEVEL=[0-9]*$/KERNEL_PATCHLEVEL=$LINUX_VERSION_PATCH/" \
|
||||
-e "s/^KREL=[0-9]*$/KREL=1/" \
|
||||
-e "s/^PKGREL=[0-9]*$/PKGREL=$LINUX_PACKAGE_RELEASE/"
|
||||
|
||||
echo "Generating entry for change log..."
|
||||
# Generate a changelog entry
|
||||
debchange -v $LINUX_VERSION-$LINUX_PACKAGE_RELEASE -D edge --force-distribution -U -M "Update to Linux $LINUX_VERSION based on $LINUX_BASE."
|
||||
|
||||
echo "Cleaning up"
|
||||
rm -f debian/control
|
||||
|
68
scripts/version.sh
Executable file
68
scripts/version.sh
Executable file
|
@ -0,0 +1,68 @@
|
|||
#!/bin/bash
|
||||
# Script for parsing version information in the repository
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
LINUX_VERSION_MAJOR=$(sed -n "s/^KERNEL_MAJ=\([0-9]*$\)/\1/p" < Makefile | xargs)
|
||||
LINUX_VERSION_MINOR=$(sed -n "s/^KERNEL_MIN=\([0-9]*$\)/\1/p" < Makefile | xargs)
|
||||
LINUX_VERSION_PATCHLEVEL=$(sed -n "s/^KERNEL_PATCHLEVEL=\([0-9]*$\)/\1/p" < Makefile | xargs)
|
||||
LINUX_VERSION_PATCHLEVEL=${LINUX_VERSION_PATCHLEVEL:-0}
|
||||
LINUX_VERSION=$LINUX_VERSION_MAJOR.$LINUX_VERSION_MINOR.$LINUX_VERSION_PATCHLEVEL
|
||||
LINUX_PACKAGE_RELEASE=$(sed -n "s/^PKGREL=\([0-9]*$\)/\1/p" < Makefile | xargs)
|
||||
LINUX_FLAVOR=$(sed -n "s/^PVE_BUILD_TYPE ?=\(.*\)$/\1/p" < Makefile | xargs)
|
||||
|
||||
|
||||
while getopts "MmprfdLh" OPTION; do
|
||||
case $OPTION in
|
||||
M)
|
||||
echo $LINUX_VERSION_MAJOR
|
||||
exit 0
|
||||
;;
|
||||
|
||||
m)
|
||||
echo $LINUX_VERSION_MINOR
|
||||
exit 0
|
||||
;;
|
||||
p)
|
||||
echo $LINUX_VERSION_PATCHLEVEL
|
||||
exit 0
|
||||
;;
|
||||
r)
|
||||
echo $LINUX_PACKAGE_RELEASE
|
||||
exit 0
|
||||
;;
|
||||
f)
|
||||
echo $LINUX_FLAVOR
|
||||
exit 0
|
||||
;;
|
||||
f)
|
||||
echo $LINUX_FLAVOR
|
||||
exit 0
|
||||
;;
|
||||
L)
|
||||
echo $LINUX_VERSION
|
||||
exit 0
|
||||
;;
|
||||
h)
|
||||
echo "commit.sh [-Mmprfh]]"
|
||||
echo " -M major version"
|
||||
echo " -m minor version"
|
||||
echo " -p patch version"
|
||||
echo " -r package release"
|
||||
echo " -f flavor name"
|
||||
echo " -L Linux version"
|
||||
echo " -h this help message"
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
echo "Incorrect options provided"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ -z "$LINUX_FLAVOR" ]]; then
|
||||
LINUX_FLAVOR_SUFFIX=-$LINUX_FLAVOR
|
||||
fi
|
||||
|
||||
echo "$LINUX_VERSION$LINUX_FLAVOR_SUFFIX-$LINUX_PACKAGE_RELEASE"
|
Loading…
Reference in a new issue