xunlei-uos: init at 1.0.0.5
This commit is contained in:
parent
416c1de7df
commit
18bda71559
102
pkgs/by-name/xu/xunlei-uos/package.nix
Normal file
102
pkgs/by-name/xu/xunlei-uos/package.nix
Normal file
@ -0,0 +1,102 @@
|
||||
{
|
||||
lib,
|
||||
dpkg,
|
||||
stdenv,
|
||||
fetchurl,
|
||||
buildFHSEnv,
|
||||
autoPatchelfHook,
|
||||
writeShellScript,
|
||||
zenity,
|
||||
nss,
|
||||
gtk2,
|
||||
alsa-lib,
|
||||
dbus-glib,
|
||||
libXtst,
|
||||
libXdamage,
|
||||
libXScrnSaver,
|
||||
}:
|
||||
|
||||
let
|
||||
sources = import ./sources.nix;
|
||||
|
||||
xunlei-unwrapped = stdenv.mkDerivation rec {
|
||||
pname = "xunlei-uos";
|
||||
version = sources.version;
|
||||
|
||||
src =
|
||||
{
|
||||
x86_64-linux = fetchurl {
|
||||
url = sources.amd64_url;
|
||||
hash = sources.amd64_hash;
|
||||
};
|
||||
aarch64-linux = fetchurl {
|
||||
url = sources.arm64_url;
|
||||
hash = sources.arm64_hash;
|
||||
};
|
||||
loongarch64-linux = fetchurl {
|
||||
url = sources.loongarch64_url;
|
||||
hash = sources.loongarch64_hash;
|
||||
};
|
||||
}
|
||||
.${stdenv.hostPlatform.system}
|
||||
or (throw "${pname}-${version}: ${stdenv.hostPlatform.system} is unsupported.");
|
||||
|
||||
buildInputs = [
|
||||
nss
|
||||
gtk2
|
||||
alsa-lib
|
||||
dbus-glib
|
||||
libXtst
|
||||
libXdamage
|
||||
libXScrnSaver
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
dpkg
|
||||
autoPatchelfHook
|
||||
];
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out/lib
|
||||
cp -r opt/apps/com.xunlei.download/files $out/lib/xunlei
|
||||
cp -r opt/apps/com.xunlei.download/entries $out/share
|
||||
mv $out/share/icons/hicolor/scalable/apps/com.thunder.download.svg \
|
||||
$out/share/icons/hicolor/scalable/apps/com.xunlei.download.svg
|
||||
substituteInPlace $out/share/applications/com.xunlei.download.desktop \
|
||||
--replace-fail "Categories=net" "Categories=Network" \
|
||||
--replace-fail "/opt/apps/com.xunlei.download/files/start.sh" "xunlei-uos" \
|
||||
--replace-fail "/opt/apps/com.xunlei.download/entries/icons/hicolor/256x256/apps/com.xunlei.download.png" "com.xunlei.download"
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Download manager supporting HTTP, FTP, BitTorrent, and eDonkey network protocols";
|
||||
homepage = "https://www.xunlei.com";
|
||||
license = lib.licenses.unfree;
|
||||
maintainers = [ lib.maintainers.linuxwhata ];
|
||||
platforms = [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
"loongarch64-linux"
|
||||
];
|
||||
};
|
||||
};
|
||||
in
|
||||
buildFHSEnv {
|
||||
inherit (xunlei-unwrapped) pname version meta;
|
||||
runScript = writeShellScript "xunlei-launcher" ''
|
||||
exec ${xunlei-unwrapped}/lib/xunlei/thunder -start $1 "$@"
|
||||
'';
|
||||
extraInstallCommands = ''
|
||||
mkdir -p $out
|
||||
ln -s ${xunlei-unwrapped}/share $out/share
|
||||
'';
|
||||
|
||||
passthru.updateScript = ./update.sh;
|
||||
|
||||
includeClosures = true;
|
||||
targetPkgs = pkgs: [ zenity ]; # system tray click events
|
||||
}
|
11
pkgs/by-name/xu/xunlei-uos/sources.nix
Normal file
11
pkgs/by-name/xu/xunlei-uos/sources.nix
Normal file
@ -0,0 +1,11 @@
|
||||
# Generated by ./update.sh - do not update manually!
|
||||
# Last updated: 2025-03-19
|
||||
{
|
||||
version = "1.0.0.5";
|
||||
amd64_url = "https://pro-store-packages.uniontech.com/appstore/pool/appstore/c/com.xunlei.download/com.xunlei.download_1.0.0.5_amd64.deb";
|
||||
arm64_url = "https://pro-store-packages.uniontech.com/appstore/pool/appstore/c/com.xunlei.download/com.xunlei.download_1.0.0.5_arm64.deb";
|
||||
loongarch64_url = "https://pro-store-packages.uniontech.com/appstore/pool/appstore/c/com.xunlei.download/com.xunlei.download_1.0.0.5_loongarch64.deb";
|
||||
amd64_hash = "sha256-K+eHPmG2tT5Z+RWxigg03itw6Rcnk5MZlODqS/JtAnk=";
|
||||
arm64_hash = "sha256-iA9mbp0wSe66qC5lphMTFPzmOJjzHfWKubGRPiKcVdg=";
|
||||
loongarch64_hash = "sha256-44QPnB/1uWHaQkd3DBMDvYXfXwch9HywZUvg71z8fts=";
|
||||
}
|
60
pkgs/by-name/xu/xunlei-uos/update.sh
Normal file
60
pkgs/by-name/xu/xunlei-uos/update.sh
Normal file
@ -0,0 +1,60 @@
|
||||
#! /usr/bin/env nix-shell
|
||||
#! nix-shell -i bash --pure --keep GITHUB_TOKEN -p nix git curl cacert nix-prefetch-git gzip
|
||||
|
||||
base_url_suffix="https://pro-store-packages.uniontech.com/appstore/dists/eagle/appstore/binary-"
|
||||
base_url_appendix="/Packages.gz"
|
||||
target_package="com.xunlei.download"
|
||||
packages_file="Packages.gz"
|
||||
|
||||
url=()
|
||||
version=() # TODO: Currently, there is no version differences between archs. This is reserved for future use.
|
||||
hash=()
|
||||
|
||||
for i in amd64 arm64 loongarch64
|
||||
do
|
||||
current_url=$base_url_suffix$i$base_url_appendix
|
||||
curl -A "Mozilla/5.0 (X11; Linux x86_64; rv:125.0) Gecko/20100101 Firefox/125.0" -v -L -O $current_url
|
||||
current_version=$(zgrep -A 20 "Package: $target_package" "$packages_file" | awk -v pkg="$target_package" '
|
||||
BEGIN { found = 0 }
|
||||
{
|
||||
if ($0 ~ "^Package: "pkg) {
|
||||
found = 1;
|
||||
}
|
||||
if (found && $1 == "Version:") {
|
||||
print $2;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
')
|
||||
version+=("$current_version")
|
||||
sha256sum=$(zgrep -A 20 "Package: $target_package" "$packages_file" | awk -v pkg="$target_package" '
|
||||
BEGIN { found = 0 }
|
||||
{
|
||||
if ($0 ~ "^Package: "pkg) {
|
||||
found = 1;
|
||||
}
|
||||
if (found && $1 == "SHA256:") {
|
||||
print $2;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
')
|
||||
url+=("https://pro-store-packages.uniontech.com/appstore/pool/appstore/c/com.xunlei.download/com.xunlei.download_"$version"_"$i".deb")
|
||||
hash+=("$(nix hash convert --to sri --hash-algo sha256 $sha256sum)")
|
||||
done
|
||||
|
||||
cat >sources.nix <<EOF
|
||||
# Generated by ./update.sh - do not update manually!
|
||||
# Last updated: $(date +%F)
|
||||
{
|
||||
version = "${version[0]}";
|
||||
amd64_url = "${url[0]}";
|
||||
arm64_url = "${url[1]}";
|
||||
loongarch64_url = "${url[2]}";
|
||||
amd64_hash = "${hash[0]}";
|
||||
arm64_hash = "${hash[1]}";
|
||||
loongarch64_hash = "${hash[2]}";
|
||||
}
|
||||
EOF
|
||||
|
||||
rm -r Packages.gz
|
Loading…
Reference in New Issue
Block a user