nixpkgs/pkgs/applications/networking/browsers/vivaldi/update.sh

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

51 lines
2.0 KiB
Bash
Raw Normal View History

2017-07-25 12:21:21 +00:00
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p libarchive curl common-updater-scripts
2019-05-14 22:38:21 +00:00
set -eu -o pipefail
2017-07-25 12:21:21 +00:00
cd "$(dirname "${BASH_SOURCE[0]}")"
root=../../../../..
export NIXPKGS_ALLOW_UNFREE=1
version() {
(cd "$root" && nix-instantiate --eval --strict -A "$1.version" | tr -d '"')
2017-07-25 12:21:21 +00:00
}
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')
2017-07-25 12:21:21 +00:00
if [[ "$vivaldi_version" = "$vivaldi_version_old" ]]; then
2019-04-11 21:09:04 +00:00
echo "vivaldi is already up-to-date"
exit
2017-07-25 12:21:21 +00:00
fi
# Download vivaldi and save hash and file path.
url="https://downloads.vivaldi.com/stable/vivaldi-stable_${vivaldi_version}-1_amd64.deb"
2017-07-25 12:21:21 +00:00
mapfile -t prefetch < <(nix-prefetch-url --print-path "$url")
hash=${prefetch[0]}
path=${prefetch[1]}
2019-04-11 21:09:04 +00:00
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"
2017-07-25 12:21:21 +00:00
(cd "$root" && update-source-version vivaldi "$vivaldi_version" "$hash")
2019-04-11 21:09:04 +00:00
git add "${default_nix}"
git commit -m "vivaldi: ${vivaldi_version_old} -> ${vivaldi_version}"
2017-07-25 12:21:21 +00:00
# Check vivaldi-ffmpeg-codecs version.
chromium_version_old=$(version vivaldi-ffmpeg-codecs)
2022-03-05 10:56:16 +00:00
ffmpeg_update_script=$(bsdtar xOf "$path" data.tar.xz | bsdtar xOf - ./opt/vivaldi/update-ffmpeg)
2022-08-11 13:58:51 +00:00
chromium_version=$(sed -rne 's/^FFMPEG_VERSION_DEB\=([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+).*/\1/p' <<< $ffmpeg_update_script)
2022-03-05 10:56:16 +00:00
download_subdir=$(sed -rne 's/.*FFMPEG_URL_DEB\=https:\/\/launchpadlibrarian\.net\/([0-9]+)\/.*_amd64\.deb/\1/p' <<< $ffmpeg_update_script)
2017-07-25 12:21:21 +00:00
if [[ "$chromium_version" != "$chromium_version_old" ]]; then
2022-03-05 10:56:16 +00:00
# replace the download prefix
sed -i $ffmpeg_nix -e "s/\(https:\/\/launchpadlibrarian\.net\/\)[0-9]\+/\1$download_subdir/g"
(cd "$root" && update-source-version vivaldi-ffmpeg-codecs "$chromium_version")
2019-04-11 21:09:04 +00:00
git add "${ffmpeg_nix}"
git commit -m "vivaldi-ffmepg-codecs: $chromium_version_old -> $chromium_version"
2017-07-25 12:21:21 +00:00
fi