makemkv: add updateScript
We exit early when the versions are the same to avoid unnecessary work in the second `update-source-version` call that has `--ignore-same-version`. That arg is necessary as otherwise it becomes a no-op since the version was updated in the previous `update-source-version` invocation.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
{
|
||||
autoPatchelfHook,
|
||||
common-updater-scripts,
|
||||
curl,
|
||||
fetchurl,
|
||||
ffmpeg,
|
||||
@@ -8,6 +9,8 @@
|
||||
openssl,
|
||||
pkg-config,
|
||||
qtbase,
|
||||
rubyPackages,
|
||||
writeShellApplication,
|
||||
zlib,
|
||||
|
||||
withJava ? true,
|
||||
@@ -83,6 +86,35 @@ mkDerivation {
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
srcs = {
|
||||
inherit src_bin src_oss;
|
||||
};
|
||||
updateScript = lib.getExe (writeShellApplication {
|
||||
name = "update-makemkv";
|
||||
runtimeInputs = [
|
||||
common-updater-scripts
|
||||
curl
|
||||
rubyPackages.nokogiri
|
||||
];
|
||||
text = ''
|
||||
get_version() {
|
||||
# shellcheck disable=SC2016
|
||||
curl --fail --silent 'https://forum.makemkv.com/forum/viewtopic.php?f=3&t=224' \
|
||||
| nokogiri -e 'puts $_.css("head title").first.text.match(/\bMakeMKV (\d+\.\d+\.\d+) /)[1]'
|
||||
}
|
||||
oldVersion=${lib.escapeShellArg version}
|
||||
newVersion=$(get_version)
|
||||
if [[ $oldVersion == $newVersion ]]; then
|
||||
echo "$0: New version same as old version, nothing to do." >&2
|
||||
exit
|
||||
fi
|
||||
update-source-version makemkv "$newVersion" --source-key=passthru.srcs.src_bin
|
||||
update-source-version makemkv "$newVersion" --source-key=passthru.srcs.src_oss --ignore-same-version
|
||||
'';
|
||||
});
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
description = "Convert blu-ray and dvd to mkv";
|
||||
longDescription = ''
|
||||
|
||||
Reference in New Issue
Block a user