Unverified Commit 4b1e8947 authored by Pol Dellaiera's avatar Pol Dellaiera Committed by GitHub
Browse files

Merge pull request #315242 from deinferno/vmware-workstation-update-1752

vmware-workstation: 17.5.1 -> 17.5.2
parents 43fe07f3 da2a8f31
Loading
Loading
Loading
Loading
+65 −24
Original line number Diff line number Diff line
{ stdenv
, buildFHSEnv
, fetchurl
, fetchzip
, lib
, zlib
, gdbm
, bzip2
, libxslt
, libxml2
, libuuid
, readline
, readline70
, xz
, cups
, glibc
@@ -25,22 +26,50 @@
, python3
, autoPatchelfHook
, makeWrapper
, sqlite
, enableInstaller ? false
, enableMacOSGuests ? false, fetchFromGitHub, gnutar, unzip
, symlinkJoin
, enableInstaller ? false, bzip2, sqlite
, enableMacOSGuests ? false, fetchFromGitHub, unzip
, enableGuestTools ? true,
}:

let
  # base - versions
  version = "17.5.2";
  build = "23775571";
  baseUrl = "https://softwareupdate.vmware.com/cds/vmw-desktop/ws/${version}/${build}/linux";

  # tools - versions
  toolsVersion = "12.4.0";
  toolsBuild = "23259341";

  # macOS - versions
  fusionVersion = "13.5.1";
  fusionBuild = "23298085";
  fusionVersion = "13.5.2";
  fusionBuild = "23775688";
  unlockerVersion = "3.0.5";

  guestToolsSrc =
  let
    fetchComponent = (system: hash: fetchzip {
      inherit hash;
      url = "${baseUrl}/packages/vmware-tools-${system}-${toolsVersion}-${toolsBuild}.x86_64.component.tar";
      stripRoot = false;
    } + "/vmware-tools-${system}-${toolsVersion}-${toolsBuild}.x86_64.component");
  in lib.mapAttrsToList fetchComponent {
      linux = "sha256-vT08mR6cCXZjiQgb9jy+MaqYzS0hFbNUM7xGAHIJ8Ao=";
      linuxPreGlibc25 = "sha256-BodN1lxuhxyLlxIQSlVhGKItJ10VPlti/sEyxcRF2SA=";
      netware = "sha256-o/S4wAYLR782Fn20fTQ871+rzsa1twnAxb9laV16XIk=";
      solaris = "sha256-3LdFoI4TD5zxlohDGR3DRGbF6jwDZAoSMEpHWU4vSGU=";
      winPre2k = "sha256-+QcvWfY3aCDxUwAfSuj7Wf9sxIO+ztWBrRolMim8Dfw=";
      winPreVista = "sha256-3NgO/GdRFTpKNo45TMet0msjzxduuoF4nVLtnOUTHUA=";
      windows = "sha256-2F7UPjNvtibmWAJxpB8IOnol12aMOGMy+403WeCTXw8=";
  };

  # macOS - ISOs
  darwinIsoSrc = fetchurl {
  darwinIsoSrc = fetchzip {
    url = "https://softwareupdate.vmware.com/cds/vmw-desktop/fusion/${fusionVersion}/${fusionBuild}/universal/core/com.vmware.fusion.zip.tar";
    sha256 = "sha256-bn6hoicby2YVj1pZTBzBhabNhKefzVQTm5vIrdTO2K4=";
  };
    sha256 = "sha256-DDLRWAVRI3ZeXV5bUXWwput9mEC1qsJUsjojI0CJYMI=";
    stripRoot = false;
  } + "/com.vmware.fusion.zip";

  # macOS - Unlocker
  unlockerSrc = fetchFromGitHub {
@@ -68,11 +97,18 @@ let
    name = "vmware-unpack-env";
    targetPkgs = pkgs: [ zlib ];
  };

  readline70_compat63 = symlinkJoin {
    name = "readline70_compat63";
    paths = [ readline70 ];
    postBuild = ''
      ln -s $out/lib/libreadline.so $out/lib/libreadline.so.6
    '';
  };
in
stdenv.mkDerivation rec {
  pname = "vmware-workstation";
  version = "17.5.1";
  build = "23298084";
  inherit version build;

  buildInputs = [
    libxslt
@@ -96,21 +132,24 @@ stdenv.mkDerivation rec {
  ];

  nativeBuildInputs = [ python3 vmware-unpack-env autoPatchelfHook makeWrapper ]
    ++ lib.optionals enableInstaller [ sqlite bzip2 ]
    ++ lib.optionals enableMacOSGuests [ gnutar unzip ];
    ++ lib.optionals enableInstaller [ bzip2 sqlite readline70_compat63 ]
    ++ lib.optionals enableMacOSGuests [ unzip ];

  src = fetchurl {
    url = "https://download3.vmware.com/software/WKST-${builtins.replaceStrings ["."] [""] version}-LX/VMware-Workstation-Full-${version}-${build}.x86_64.bundle";
    sha256 = "sha256-qmC3zvKoes77z3x6UkLHsJ17kQrL1a/rxe9mF+UMdJY=";
  };
  src = fetchzip {
    url = "${baseUrl}/core/VMware-Workstation-${version}-${build}.x86_64.bundle.tar";
    sha256 = "sha256-5PZZpXN/V687TXjqeTm8MEays4/QTf02jVfdpi9C7GI=";
    stripRoot = false;
  } + "/VMware-Workstation-${version}-${build}.x86_64.bundle";

  unpackPhase = ''
    ${vmware-unpack-env}/bin/vmware-unpack-env -c "sh ${src} --extract unpacked"
  unpackPhase = let
    guestTools = lib.optionalString enableGuestTools (lib.concatMapStringsSep " " (src: "--install-component ${src}") guestToolsSrc);
  in
  ''
    ${vmware-unpack-env}/bin/vmware-unpack-env -c "sh ${src} ${guestTools} --extract unpacked"

    ${lib.optionalString enableMacOSGuests ''
      mkdir -p fusion/
      tar -xvpf "${darwinIsoSrc}" -C fusion/
      unzip "fusion/com.vmware.fusion.zip" \
      unzip "${darwinIsoSrc}" \
        "payload/VMware Fusion.app/Contents/Library/isoimages/x86_x64/darwin.iso" \
        "payload/VMware Fusion.app/Contents/Library/isoimages/x86_x64/darwinPre15.iso" \
        -d fusion/
@@ -173,7 +212,7 @@ stdenv.mkDerivation rec {
        component_version=$(cat unpacked/$component/manifest.xml | grep -oPm1 "(?<=<version>)[^<]+")
        component_core_id=$([ "$component" == "vmware-installer" ] && echo "-1" || echo "1")
        type=$([ "$component" == "vmware-workstation" ] && echo "0" || echo "1")
        sqlite3 "$database_filename" "INSERT INTO components(name,version,buildNumber,component_core_id,longName,description,type) VALUES(\"$component\",\"$component_version\",\"${build}\",$component_core_id,\"$component\",\"$component\",$type);"
        sqlite3 "$database_filename" "INSERT INTO components(name,version,buildNumber,component_core_id,longName,description,type) VALUES('$component','$component_version',${build},$component_core_id,'$component','$component',$type);"
        mkdir -p $out/etc/vmware-installer/components/$component
        cp -r $folder/* $out/etc/vmware-installer/components/$component
      done
@@ -255,9 +294,10 @@ stdenv.mkDerivation rec {
    unpacked="unpacked/vmware-network-editor"
    cp -r $unpacked/lib $out/lib/vmware/

    ## VMware Tools
    echo "Installing VMware Tools"
    mkdir -p $out/lib/vmware/isoimages/

    ${lib.optionalString enableGuestTools ''
    echo "Installing VMware Tools"
    cp unpacked/vmware-tools-linux/linux.iso \
       unpacked/vmware-tools-linuxPreGlibc25/linuxPreGlibc25.iso \
       unpacked/vmware-tools-netware/netware.iso \
@@ -266,6 +306,7 @@ stdenv.mkDerivation rec {
       unpacked/vmware-tools-winPreVista/winPreVista.iso \
       unpacked/vmware-tools-windows/windows.iso \
       $out/lib/vmware/isoimages/
    ''}

    ${lib.optionalString enableMacOSGuests ''
      echo "Installing VMWare Tools for MacOS"