A checknupdate.sh => checknupdate.sh +40 -0
@@ 0,0 1,40 @@
+#!/bin/bash
+git pull --no-edit
+
+VER=$(grep '^_pkgver=' PKGBUILD | cut -d '=' -f 2)
+CURR_VERSION=$(echo $VER | cut -d '.' -f 1)
+CURR_PATCHLEVEL=$(echo $VER | cut -d '.' -f 2)
+CURR_SUBLEVEL=$(echo $VER | cut -d '.' -f 3)
+CURR_BRANCH=$CURR_VERSION.$CURR_PATCHLEVEL
+
+VERSION=$(rsstail -1pNu https://www.kernel.org/feeds/kdist.xml | grep "^ $CURR_VERSION\.$CURR_PATCHLEVEL[:\.]")
+
+if [ ! -n "$VERSION" ];then
+ echo "Error: $CURR_BRANCH may be EOLed"
+ exit 1
+fi
+
+NEW_SUBLEVEL=$(echo "$VERSION" | tail -n 1 | cut -d ':' -f 1 | cut -d '.' -f 3)
+
+if [ ! -n "$NEW_SUBLEVEL" ];then
+ exit 0
+fi
+
+if [ "$NEW_SUBLEVEL" -gt "$CURR_SUBLEVEL" ];then
+ echo "Update: $CURR_BRANCH.$CURR_SUBLEVEL -> $CURR_BRANCH.$NEW_SUBLEVEL"
+ #https://cdn.kernel.org/pub/linux/kernel/v4.x/incr/patch-4.17.5-6.xz
+ if [ "$NEW_SUBLEVEL" -eq 1 ];then
+ echo "Manual work required for first patch"
+ exit 1
+ fi
+ sed "s/pkgver=$VER/pkgver=$CURR_BRANCH.$NEW_SUBLEVEL/" -i APKBUILD
+ podman run -itu builder -w /home/builder -v .:/home/builder --userns keep-id registry.xdavidwu.link/ci-modulize/abuild:edge sh -c 'abuild checksum && apkgrel -z APKBUILD'
+ SED_ERRNO=$?
+ git add APKBUILD
+ if [ "$SED_ERRNO" -eq 0 ];then
+ git commit -m "Auto Update: $CURR_BRANCH.$CURR_SUBLEVEL -> $CURR_BRANCH.$NEW_SUBLEVEL"
+ else
+ git commit -m "[FAILED] Auto Update: $CURR_BRANCH.$CURR_SUBLEVEL -> $CURR_BRANCH.$NEW_SUBLEVEL"
+ fi
+ git push
+fi