Unverified Commit 6d5db91a authored by Bu Kun's avatar Bu Kun
Browse files

wpsoffice{-cn}: 11.1.0.11711 -> 11.1.0.11719

parent f63ce824
Loading
Loading
Loading
Loading
+39 −10
Original line number Diff line number Diff line
@@ -16,20 +16,49 @@
, xorg
, cups
, pango
, runCommandLocal
, curl
, coreutils
, cacert
, useChineseVersion ? false
}:

let
  pkgVersion = "11.1.0.11719";
  url =
    if useChineseVersion then
      "https://wps-linux-personal.wpscdn.cn/wps/download/ep/Linux2019/${lib.last (lib.splitVersion pkgVersion)}/wps-office_${pkgVersion}_amd64.deb"
    else
      "https://wdl1.pcfg.cache.wpscdn.com/wpsdl/wpsoffice/download/linux/${lib.last (lib.splitVersion pkgVersion)}/wps-office_${pkgVersion}.XA_amd64.deb";
  hash =
    if useChineseVersion then
      "sha256-LgE5du2ZnMsAqgoQkY63HWyWYA5TLS5I8ArRYrpxffs="
    else
      "sha256-6fXzHSMzZDGuBubOXsHA0YEUGKcy5QIPg3noyxUbdjA=";
  uri = builtins.replaceStrings [ "https://wps-linux-personal.wpscdn.cn" ] [ "" ] url;
  securityKey = "7f8faaaa468174dc1c9cd62e5f218a5b";
in
stdenv.mkDerivation rec {
  pname = "wpsoffice";
  version = "11.1.0.11711";
  version = pkgVersion;

  src = if useChineseVersion then fetchurl {
    url = "https://wps-linux-personal.wpscdn.cn/wps/download/ep/Linux2019/${lib.last (lib.splitVersion version)}/wps-office_${version}_amd64.deb";
    hash = "sha256-JHSTZZnOZoTpj8zF4C5PmjTkftEdxbeaqweY3ITiJto=";
  } else fetchurl {
    url = "https://wdl1.pcfg.cache.wpscdn.com/wpsdl/wpsoffice/download/linux/${lib.last (lib.splitVersion version)}/wps-office_${version}.XA_amd64.deb";
    hash = "sha256-2apkSE/8Wm6/OQ4x5n1PE1emhovqOgD0NVTY5QZZTYA=";
  };
  src = runCommandLocal (if useChineseVersion then "wps-office_${version}_amd64.deb" else "wps-office_${version}.XA_amd64.deb")
    {
      outputHashMode = "recursive";
      outputHashAlgo = "sha256";
      outputHash = hash;

      nativeBuildInputs = [ curl coreutils ];

      SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
    } ''
    timestamp10=$(date '+%s')
    md5hash=($(echo -n "${securityKey}${uri}$timestamp10" | md5sum))

    curl \
    --retry 3 --retry-delay 3 \
    "${url}?t=$timestamp10&k=$md5hash" \
    > $out
  '';

  unpackCmd = "dpkg -x $src .";
  sourceRoot = ".";
@@ -102,6 +131,6 @@ stdenv.mkDerivation rec {
    sourceProvenance = with sourceTypes; [ binaryNativeCode ];
    hydraPlatforms = [ ];
    license = licenses.unfreeRedistributable;
    maintainers = with maintainers; [ mlatus th0rgal rewine ];
    maintainers = with maintainers; [ mlatus th0rgal rewine pokon548 ];
  };
}