Merge pull request #220917 from wegank/vivaldi-update

vivaldi: add updateScript
This commit is contained in:
Weijia Wang 2023-03-13 20:13:18 +02:00 committed by GitHub
commit b29350a3ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 9 deletions

View File

@ -108,6 +108,8 @@ in stdenv.mkDerivation rec {
runHook postInstall
'';
passthru.updateScript = ./update-vivaldi.sh;
meta = with lib; {
description = "A Browser for our Friends, powerful and personal";
homepage = "https://vivaldi.com";

View File

@ -0,0 +1,16 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl common-updater-scripts
set -eu -o pipefail
version=$(curl -sS https://vivaldi.com/download/ | sed -rne 's/.*vivaldi-stable_([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)-1_amd64\.deb.*/\1/p')
update_hash() {
url="https://downloads.vivaldi.com/stable/vivaldi-stable_$version-1_$2.deb"
hash=$(nix hash to-sri --type sha256 $(nix-prefetch-url --type sha256 "$url"))
update-source-version vivaldi 0 sha256-BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB= --system=$1
update-source-version vivaldi "$version" "$hash" --system=$1
}
update_hash aarch64-linux arm64
update_hash x86_64-linux amd64

View File

@ -14,26 +14,23 @@ version() {
vivaldi_version_old=$(version vivaldi)
vivaldi_version=$(curl -sS https://vivaldi.com/download/ | sed -rne 's/.*vivaldi-stable_([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)-1_amd64\.deb.*/\1/p')
if [[ "$vivaldi_version" = "$vivaldi_version_old" ]]; then
echo "vivaldi is already up-to-date"
if [[ ! "$vivaldi_version" = "$vivaldi_version_old" ]]; then
echo "vivaldi is not up-to-date, not updating codecs"
(cd "$root" && nix-shell maintainers/scripts/update.nix --argstr package vivaldi)
exit
fi
# Download vivaldi and save hash and file path.
echo "vivaldi is up-to-date, updating codecs"
# Download vivaldi and save file path.
url="https://downloads.vivaldi.com/stable/vivaldi-stable_${vivaldi_version}-1_amd64.deb"
mapfile -t prefetch < <(nix-prefetch-url --print-path "$url")
hash=${prefetch[0]}
path=${prefetch[1]}
nixpkgs="$(git rev-parse --show-toplevel)"
default_nix="$nixpkgs/pkgs/applications/networking/browsers/vivaldi/default.nix"
ffmpeg_nix="$nixpkgs/pkgs/applications/networking/browsers/vivaldi/ffmpeg-codecs.nix"
(cd "$root" && update-source-version vivaldi "$vivaldi_version" "$hash")
git add "${default_nix}"
git commit -m "vivaldi: ${vivaldi_version_old} -> ${vivaldi_version}"
# Check vivaldi-ffmpeg-codecs version.
chromium_version_old=$(version vivaldi-ffmpeg-codecs)
ffmpeg_update_script=$(bsdtar xOf "$path" data.tar.xz | bsdtar xOf - ./opt/vivaldi/update-ffmpeg)