Add script which automates updating this package

This commit is contained in:
Mikhail Novosyolov 2021-11-28 22:31:42 +03:00
parent 4f485b572c
commit 5699e8a7a8

42
upd.sh Executable file
View file

@ -0,0 +1,42 @@
#!/usr/bin/env bash
# Script to partly automate updating this package
set -x
set -e
set -f
set -u
spec=chromium-browser-stable.spec
old_version="$(rpmspec -q --srpm --qf '%{version}' "$spec")"
latest_version="$(curl -s 'https://omahaproxy.appspot.com/all?os=linux&channel=stable' | sed 1d | cut -d , -f 3)"
[ -n "$latest_version" ]
if [ "$old_version" = "$latest_version" ]; then
echo "No updates"
exit 0
fi
# https://stackoverflow.com/a/66636133
latest_commit_chromium_gost="$(curl -s -H "Accept: application/vnd.github.VERSION.sha" "https://api.github.com/repos/deemru/chromium-gost/commits/master")"
[ -n "$latest_commit_chromium_gost" ]
latest_commit_msspi="$(curl -s -H "Accept: application/vnd.github.VERSION.sha" "https://api.github.com/repos/deemru/msspi/commits/master")"
[ -n "$latest_commit_msspi" ]
sed -E -i'' "$spec" \
-e "s,^Version:.+,Version:\t${latest_version}," \
-e "s,^Release:.+,Release:\t1," \
-e "s,^%define chromium_gost_commit .+,%define chromium_gost_commit ${latest_commit_chromium_gost}," \
-e "s,^%define msspi_commit .+,%define msspi_commit ${latest_commit_msspi}," \
--
spectool --get-files --source 0,1101,1102 "$spec"
sed -i'' .abf.yml -e '/^ chromium-/d' -e '/^ msspi-/d'
abf put -n
# abf put erronously uploads *.json
git checkout master_preferences.json
sed -i'' .abf.yml -e '/^ master_preferences.json/d'
PAGER='' git diff
# can be copypasted for a commit message
echo "upd: $old_version -> $latest_version"