~xdavidwu/linux-xdavidwu-xps

e0290e7d93fecf766feee20d1bb78d72aa808651 — xdavidwu 1 year, 4 months ago f81eba4
checknupdate: make it more reliable

cdn seems to update slower these days and checksum is likely to fail due
to no file when feed update observed
1 files changed, 8 insertions(+), 4 deletions(-)

M checknupdate.sh
M checknupdate.sh => checknupdate.sh +8 -4
@@ 1,4 1,7 @@
#!/bin/bash
#!/bin/sh

set -e

git pull --no-edit

VER=$(grep '^pkgver=' APKBUILD | cut -d '=' -f 2)


@@ 20,11 23,12 @@ if [ ! -n "$NEW_SUBLEVEL" ];then
	exit 0
fi

if [ "$NEW_SUBLEVEL" -gt "$CURR_SUBLEVEL" ];then
(if [ "$NEW_SUBLEVEL" -gt "$CURR_SUBLEVEL" ];then
	echo "Update: $CURR_BRANCH.$CURR_SUBLEVEL -> $CURR_BRANCH.$NEW_SUBLEVEL"
	sed "s/pkgver=$VER/pkgver=$CURR_BRANCH.$NEW_SUBLEVEL/" -i APKBUILD
	SED_ERRNO=$?
	abuild checksum && apkgrel -z APKBUILD
	abuild checksum
	apkgrel -z APKBUILD
	git add APKBUILD
	if [ "$SED_ERRNO" -eq 0 ];then
		git commit -m "Auto Update: $CURR_BRANCH.$CURR_SUBLEVEL -> $CURR_BRANCH.$NEW_SUBLEVEL"


@@ 32,4 36,4 @@ if [ "$NEW_SUBLEVEL" -gt "$CURR_SUBLEVEL" ];then
		git commit -m "[FAILED] Auto Update: $CURR_BRANCH.$CURR_SUBLEVEL -> $CURR_BRANCH.$NEW_SUBLEVEL"
	fi
	git push
fi
fi) || git reset --hard