Unverified Commit 33e923fa authored by Weijia Wang's avatar Weijia Wang Committed by GitHub
Browse files

linuxPackages_latest.prl-tools: 20.0.0-55653 -> 20.0.1-55659 (#343082)

parents 9063fd2f 59070b80
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -4050,6 +4050,12 @@
    email = "jupiter@m.rdis.dev";
    name = "Scott Little";
  };
  codgician = {
    email = "codgician@outlook.com";
    github = "codgician";
    githubId = 15964984;
    name = "codgician";
  };
  codifryed = {
    email = "gb@guyboldon.com";
    name = "Guy Boldon";
+5 −3
Original line number Diff line number Diff line
@@ -37,13 +37,13 @@ let
in
stdenv.mkDerivation (finalAttrs: {
  pname = "prl-tools";
  version = "20.0.0-55653";
  version = "20.0.1-55659";

  # We download the full distribution to extract prl-tools-lin.iso from
  # => ${dmg}/Parallels\ Desktop.app/Contents/Resources/Tools/prl-tools-lin.iso
  src = fetchurl {
    url = "https://download.parallels.com/desktop/v${lib.versions.major finalAttrs.version}/${finalAttrs.version}/ParallelsDesktop-${finalAttrs.version}.dmg";
    hash = "sha256-ohGhaLVzXuR/mQ6ToeGbTixKy01F14JSgTs128vGZXM=";
    hash = "sha256-5h8WZB7L6D9KOgIPSstN1sNcf3FZQiOQFB5MUC4YzvA=";
  };

  hardeningDisable = [ "pic" "format" ];
@@ -169,11 +169,13 @@ stdenv.mkDerivation (finalAttrs: {
    runHook postInstall
  '';

  passthru.updateScript = ./update.sh;

  meta = with lib; {
    description = "Parallels Tools for Linux guests";
    homepage = "https://parallels.com";
    license = licenses.unfree;
    maintainers = with maintainers; [ catap wegank ];
    maintainers = with maintainers; [ catap wegank codgician ];
    platforms = platforms.linux;
  };
})
+39 −0
Original line number Diff line number Diff line
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl jq

set -eu -o pipefail

nixpkgs="$(git rev-parse --show-toplevel)"
path="$nixpkgs/pkgs/os-specific/linux/prl-tools/default.nix"

# Currently this script only supports Parallels 20
# Please change the knowledge base url after each major release
kb_url="https://kb.parallels.com/en/130212"
content="$(curl -s "$kb_url")"

# Match latest version from Parallels knowledge base
regex='<meta property="og:description" content="[^"]*Parallels Desktop ([0-9]+) for Mac ([0-9]+\.[0-9]+\.[0-9+]) \(([0-9]+)\)[^"]*" />'
if [[ $content =~ $regex ]]; then
    major_version="${BASH_REMATCH[1]}"
    version="${BASH_REMATCH[2]}-${BASH_REMATCH[3]}"
    echo "Found latest version: $version, major version: $major_version"
else
    echo "Failed to extract version from $kb_url"
    exit 1
fi

# Extract and compare current version
old_version="$(grep -o 'version = ".*"' "$path" | awk -F'"' '{print $2}')"
if [[ "$old_version" > "$version" || "$old_version" == "$version" ]]; then
    echo "Current version $old_version is up-to-date"
    exit 0
fi

# Update version and hash
dmg_url="https://download.parallels.com/desktop/v${major_version}/${version}/ParallelsDesktop-${version}.dmg"
sha256="$(nix store prefetch-file $dmg_url --json | jq -r '.hash')"
sed -i -e "s/version = \"$old_version\"/version = \"$version\"/" \
    -e "s/hash = \"sha256-.*\"/hash = \"$sha256\"/" "$path"

git commit -qm "linuxPackages_latest.prl-tools: $old_version -> $version" "$path"
echo "Updated linuxPackages_latest.prl-tools $old_version -> $version"