prl-tools: 26.4.2-57518 -> 27.0.1-58670

This commit is contained in:
codgician
2026-09-06 01:03:12 +08:00
committed by Weijia Wang
parent 52ba49fcaf
commit 71a4e2e9bc
2 changed files with 31 additions and 49 deletions

View File

@@ -6,25 +6,22 @@
cups,
dbus,
fetchurl,
fuse,
fuse3,
gawk,
glib,
gnugrep,
gnused,
gtk3,
lib,
makeWrapper,
netcat,
p7zip,
perl,
stdenv,
timetrap,
undmg,
util-linux,
wayland,
libxrandr,
libxi,
libxinerama,
libxext,
libxcomposite,
libx11,
}:
let
@@ -38,6 +35,8 @@ let
"${coreutils}/bin"
"${cups}/sbin"
"${gawk}/bin"
"${gnugrep}/bin"
"${gnused}/bin"
"${netcat}/bin"
"${timetrap}/bin"
"${util-linux}/bin"
@@ -45,43 +44,30 @@ let
in
stdenv.mkDerivation (finalAttrs: {
pname = "prl-tools";
version = "26.4.2-57518";
version = "27.0.1-58670";
# 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-7VDr4mfHnDfsjf77wem8zcyHIpgV1RvvIOpp2C+SZTk=";
hash = "sha256-ZchIQQ/FyzLmcL2ust1YAqlSsRZWJmDO3t3Ywxo39P0=";
};
hardeningDisable = [
"pic"
"format"
];
nativeBuildInputs = [
autoPatchelfHook
bbe
makeWrapper
p7zip
perl
undmg
];
buildInputs = [
fuse
glib
libx11
libxcomposite
libxext
libxrandr
libxi
libxinerama
];
buildInputs = [ (lib.getLib stdenv.cc.cc) ];
runtimeDependencies = [
dbus
glib
dbus.lib
fuse3.out # prl_fsd dlopens libfuse3.so.3 or libfuse3.so.4
glib.out
gtk3.out
libxrandr
];
@@ -108,31 +94,33 @@ stdenv.mkDerivation (finalAttrs: {
else
"32"
}
mkdir -p $out/lib
# prltoolsd contains hardcoded /bin/bash path
# we're lucky because it uses only -c command
# => replace to /bin/sh
# prltoolsd executes /bin/bash with /bin/sh as its upstream fallback.
# Use /bin/sh directly, including in its SHELL environment entry.
bbe -e "s:/bin/bash:/bin/sh\x00\x00:" -o bin/prltoolsd.tmp bin/prltoolsd
rm -f bin/prltoolsd
mv bin/prltoolsd.tmp bin/prltoolsd
# replace hardcoded /usr/bin/prl_fsd
substituteInPlace ../mount.fuse.prl_fsd \
--replace-fail "/usr/bin/prl_fsd" "$out/bin/prl_fsd"
# NixOS manages fstab declaratively; automounting must not touch it.
substituteInPlace ../prlfsmountd.sh \
--replace-fail '[ -f /etc/fstab ] && touch -c /etc/fstab' ""
# install binaries
# Leave out the upstream ptiagent self-updater: updates are managed by Nix.
for i in bin/* sbin/prl_nettool sbin/prl_snapshot; do
# also patch binaries to replace /usr/bin/XXX to XXX
# here a two possible cases:
# 1. it is uses as null terminated string and should be truncated by null;
# 2. it is uses inside shell script and should be truncated by space.
# Preserve binary offsets: NUL-pad executable paths and space-pad
# paths embedded in shell commands.
for p in bin/* sbin/prl_nettool sbin/prl_snapshot sbin/prlfsmountd; do
p=$(basename $p)
bbe -e "s:/usr/bin/$p\x00:./$p\x00\x00\x00\x00\x00\x00\x00\x00:" -o $i.tmp $i
bbe -e "s:/usr/sbin/$p\x00:./$p\x00\x00\x00\x00\x00\x00\x00\x00 :" -o $i $i.tmp
bbe -e "s:/usr/bin/$p:$p :" -o $i.tmp $i
bbe -e "s:/usr/sbin/$p:$p :" -o $i $i.tmp
bbe \
-e "s:/usr/bin/$p\x00:./$p\x00\x00\x00\x00\x00\x00\x00\x00:" \
-e "s:/usr/bin/$p:$p :" \
-e "s:/usr/sbin/$p:$p :" \
-o $i.tmp $i
mv $i.tmp $i
done
install -Dm755 $i $out/$i
@@ -147,15 +135,9 @@ stdenv.mkDerivation (finalAttrs: {
--prefix PATH ':' "${scriptPath}"
done
for i in lib/libPrl*.0.0; do
cp $i $out/lib
ln -s $out/$i $out/''${i%.0.0}
done
substituteInPlace ../99prltoolsd-hibernate \
--replace-fail "/bin/bash" "${bash}/bin/bash"
mkdir -p $out/etc/pm/sleep.d
install -Dm644 ../99prltoolsd-hibernate $out/etc/pm/sleep.d
)

View File

@@ -6,9 +6,9 @@ set -eu -o pipefail
nixpkgs="$(git rev-parse --show-toplevel)"
path="$nixpkgs/pkgs/by-name/pr/prl-tools/package.nix"
# Currently this script only supports Parallels 26
# Currently this script only supports Parallels 27
# Please change the knowledge base url after each major release
kb_url="https://kb.parallels.com/en/131014"
kb_url="https://kb.parallels.com/en/131168"
content="$(curl -s "$kb_url")"
# Extract all version/build pairs and select the latest (by semver, then build)
@@ -50,4 +50,4 @@ 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"
echo "Updated linuxPackages_latest.prl-tools $old_version -> $version"
echo "Updated prl-tools $old_version -> $version"