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

linuxPackages_latest.prl-tools: 20.4.1-55996 -> 26.0.0-57238 (#438511)

parents 56e0275a df87bc38
Loading
Loading
Loading
Loading
+1 −15
Original line number Diff line number Diff line
{
  config,
  lib,
  pkgs,
  ...
}:

@@ -55,11 +54,8 @@ in
    boot.extraModulePackages = [ prl-tools ];

    boot.kernelModules = [
      "prl_fs"
      "prl_fs_freeze"
      "prl_tg"
    ]
    ++ optional (pkgs.stdenv.hostPlatform.system == "aarch64-linux") "prl_notifier";
    ];

    services.timesyncd.enable = false;

@@ -114,15 +110,6 @@ in
          WorkingDirectory = "${prl-tools}/bin";
        };
      };
      prlsga = {
        description = "Parallels Shared Guest Applications Tool";
        wantedBy = [ "graphical-session.target" ];
        path = [ prl-tools ];
        serviceConfig = {
          ExecStart = "${prl-tools}/bin/prlsga";
          WorkingDirectory = "${prl-tools}/bin";
        };
      };
      prlshprof = {
        description = "Parallels Shared Profile Tool";
        wantedBy = [ "graphical-session.target" ];
@@ -133,6 +120,5 @@ in
        };
      };
    };

  };
}
+0 −8
Original line number Diff line number Diff line
[Desktop Entry]
Version=@version@
Encoding=UTF-8
Name=@description@
Type=Application
Exec=@exec@
X-KDE-autostart-phase=1
GenericName[en_US]=
+2 −4
Original line number Diff line number Diff line
@@ -43,13 +43,13 @@ let
in
stdenv.mkDerivation (finalAttrs: {
  pname = "prl-tools";
  version = "20.4.1-55996";
  version = "26.0.0-57238";

  # 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-CEyP8YZPLzjVAAjOaUqwQ4Ilzk9ybAtTTZUGZbSRrKQ=";
    hash = "sha256-UuQGW1qYLGVLqAzApPKBqfOZdS23mCPsID4D0HATHNw=";
  };

  hardeningDisable = [
@@ -118,9 +118,7 @@ stdenv.mkDerivation (finalAttrs: {
    ( # kernel modules
      cd kmods
      mkdir -p $out/lib/modules/${kernelVersion}/extra
      cp prl_fs_freeze/Snapshot/Guest/Linux/prl_freeze/prl_fs_freeze.ko $out/lib/modules/${kernelVersion}/extra
      cp prl_tg/Toolgate/Guest/Linux/prl_tg/prl_tg.ko $out/lib/modules/${kernelVersion}/extra
      ${lib.optionalString stdenv.hostPlatform.isAarch64 "cp prl_notifier/Installation/lnx/prl_notifier/prl_notifier.ko $out/lib/modules/${kernelVersion}/extra"}
    )

    ( # tools
+27 −14
Original line number Diff line number Diff line
@@ -6,23 +6,36 @@ 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
# Currently this script only supports Parallels 26
# Please change the knowledge base url after each major release
kb_url="https://kb.parallels.com/en/130212"
kb_url="https://kb.parallels.com/en/131014"
content="$(curl -s "$kb_url")"

# Parse HTML content and retrieve og:description for header metadata
description=$(echo "$content" | xmllint --recover --html --xpath 'string(//meta[@property="og:description"]/@content)' - 2>/dev/null)
regex='[^0-9]+([0-9]+\.[0-9]+\.[0-9]+)[^\(]+\(([0-9]+)\)'
if [[ $description =~ $regex ]]; then
    version="${BASH_REMATCH[1]}-${BASH_REMATCH[2]}"
    echo "Found latest version: $version"
else
    echo "Failed to extract version from $kb_url" >&2
    echo "Retrived description: $description" >&2
# Extract all version/build pairs and select the latest (by semver, then build)
# Prefer the article content; fallback to whole body text
article_text="$(echo "$content" | xmllint --recover --html --xpath 'string(//div[@id="article-content"])' - 2>/dev/null || true)"
if [[ -z "${article_text:-}" ]]; then
  article_text="$(echo "$content" | xmllint --recover --html --xpath 'string(//body)' - 2>/dev/null || echo "$content")"
fi

# Find all "X.Y.Z (BUILD)" occurrences like "20.4.1 (55996)"
mapfile -t candidates < <(echo "$article_text" \
  | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+[[:space:]]*\(([0-9]+)\)' \
  | sed -E 's/([0-9]+\.[0-9]+\.[0-9]+)[[:space:]]*\(([0-9]+)\)/\1 \2/' \
  | sort -u)

if [[ ${#candidates[@]} -eq 0 ]]; then
  echo "Failed to extract any version from $kb_url" >&2
  exit 1
fi

# Sort by version then build and pick the highest
latest_pair="$(printf '%s\n' "${candidates[@]}" | sort -V -k1,1 -k2,2n | tail -n1)"
latest_ver="$(awk '{print $1}' <<< "$latest_pair")"
latest_build="$(awk '{print $2}' <<< "$latest_pair")"
version="${latest_ver}-${latest_build}"
echo "Found latest version: $version"

# Extract and compare current version
old_version="$(grep -o 'version = ".*"' "$path" | awk -F'"' '{print $2}')"
if [[ "$old_version" > "$version" || "$old_version" == "$version" ]]; then
@@ -31,9 +44,9 @@ if [[ "$old_version" > "$version" || "$old_version" == "$version" ]]; then
fi

# Update version and hash
major_version=$(echo $version | cut -d. -f1)
major_version="$(echo "$version" | cut -d. -f1)"
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')"
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"