#!/usr/bin/env bash # Script to partly automate updating this package # sudo dnf install /usr/bin/rpmbuild /usr/bin/spectool /usr/bin/rpmspec /usr/bin/git /usr/bin/curl /usr/bin/abf set -x set -e set -f set -u # try to avoid asking for password in `sudo mount -t tmpfs <...>` #sudo echo 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" # check appliability of patches patches_ok=0 # unpack >8 GiB of source code, I do not have so much RAM to store it in tmpfs tmp="$(mktemp --tmpdir=/var/tmp -d)" #sudo mount -t tmpfs -o size=30G tmpfs "$tmp" trap 'if [ "$patches_ok" = 1 ]; then rm -fr "$tmp"; fi' EXIT sed -i'' .abf.yml -e '/^ chromium-/d' -e '/^ msspi-/d' abf put -n # abf put erronously uploads *.json git checkout master_preferences.json # store SVG in git git checkout rosa-logo-for-new-tab-page.svg git checkout 22x22_chromium.svg 48x48_chromium.svg sed -i'' .abf.yml -e '/^ master_preferences.json/d' -e '/.svg/d' # download additional sources abf fetch rpmbuild --define "_sourcedir $PWD" --define "_builddir $tmp" -bp "$spec" && patches_ok=1 PAGER='' git diff # can be copypasted for a commit message echo "upd: $old_version -> $latest_version" if [ "$patches_ok" = 0 ]; then echo "PATCHES require attention!" fi