diff options
author | Anderson Rocha(MAX) | 2021-12-10 14:03:18 -0300 |
---|---|---|
committer | Anderson Rocha(MAX) | 2021-12-10 14:03:18 -0300 |
commit | 89d95674f54a1d962a240195eca4dac53d94359a (patch) | |
tree | 47a392e3a52049511982af66de46d168adcfd396 | |
parent | 3ff20c0e270e005a2deed8a97ef896eeab15f955 (diff) | |
download | aur-89d95674f54a1d962a240195eca4dac53d94359a.tar.gz |
Auto updater + readme
-rw-r--r-- | .gitignore | 5 | ||||
-rw-r--r-- | README.md | 27 | ||||
-rw-r--r-- | auto_update.sh | 79 |
3 files changed, 110 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore index 72e8ffc0db8a..aaf5e724300e 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ -* +/pkg +/src/ +/cef_* +/cef-* diff --git a/README.md b/README.md new file mode 100644 index 000000000000..61af8a541d82 --- /dev/null +++ b/README.md @@ -0,0 +1,27 @@ +## How to update + +The process of auto update follows the following workflow +1. pull repo from AUR +2. Patch hashs and versions for `linux64` +3. Patch hashs and versions for `linux32` +4. Builds the package +5. If succeeds, generate the commit `[AUTO] Version <version>` +6. Clean up the build folder + +Run the following command to update +```sh +$ sh auto_update.sh +``` + +Dry run (download and build) +```sh +$ SKIP_PUSH=true sh auto_update.sh +``` + +### Maintainers +Active Maintainers: +- Anderson Rocha <anderson2320@gmail.com> + +Previous Maintainers: +- etriguba <eugenetriguba@gmail.com> +- NexAdn <nexadn@yandex.com> diff --git a/auto_update.sh b/auto_update.sh new file mode 100644 index 000000000000..c410e6f63581 --- /dev/null +++ b/auto_update.sh @@ -0,0 +1,79 @@ +#! /bin/bash + +service_url="https://cef-builds.spotifycdn.com" + +versions=$(curl -s "$service_url/index.json") + +stripQuotes() { + sed -e 's/^"//' -e 's/"$//' <<<$1 +} + +replace_line() { + sed -i "$2s#.*#$1#" $3 +} + +update_version() { + local arch=$1; + + stable=$(echo $versions | jq ".$arch.versions | .[1]"); + + # versions + version_arr=$(echo $stable | jq '.cef_version | split("+")'); + + version=$(stripQuotes $(echo $version_arr | jq '.[0]')); + build_hash=$(stripQuotes $(echo $version_arr | jq '.[1]')); + chromium_version=$(stripQuotes $(echo $version_arr | jq '.[2] | split("-") | .[1]')); + + minimal=$(echo $stable | jq '.files | map(select(.type == "standard" )) | .[0]'); + + filename=$(stripQuotes $(echo $minimal | jq '.name' )) + sha_hash=$(stripQuotes $(echo $minimal | jq '.sha1' )) + + file_url=$service_url/$filename + + # update PKGBUILD + replace_line "pkgver=\"$version\"" 4 PKGBUILD + replace_line "_chromiumver=\"$chromium_version\"" 6 PKGBUILD + replace_line "_pkgcommit=\"$build_hash\"" 5 PKGBUILD + + # update .SRCINFO + replace_line " pkgver = $version" 3 .SRCINFO + + if [ $arch = "linux64" ]; then + replace_line "sha1sums_x86_64=(\"$sha_hash\")" 28 PKGBUILD + + replace_line " source_x86_64 = $file_url" 27 .SRCINFO + replace_line " sha1sums_x86_64 = $sha_hash" 28 .SRCINFO + else + replace_line "sha1sums_i686=(\"$sha_hash\")" 27 PKGBUILD + + replace_line " source_i686 = $file_url" 25 .SRCINFO + replace_line " sha1sums_i686 = $sha_hash" 26 .SRCINFO + fi +} + +echo "UPDATING " +git pull > /dev/null + +echo "- Patching x86_64..." +update_version linux64 + +echo "- Patching i686..." +update_version linux32 + +echo $version +echo "- Rebuilding(makepkg)..." +makepkg > /dev/null + +if [ -z ${SKIP_PUSH+x} ]; then + echo "- Uploading to AUR" + git add .SRCINFO PKGBUILD > /dev/null + git commit -m "[AUTO] Version $version" > /dev/null + git push > /dev/null +fi + +echo "Cleanup" +rm -r src/* > /dev/null +rm -r pkg/* > /dev/null + +echo "DONE" |