theos icon indicating copy to clipboard operation
theos copied to clipboard

Use plistutil instead of plutil on Linux

Open fxfactorial opened this issue 8 years ago • 14 comments

This is on head and on linux.

when doing:

FOR_RELEASE=1 make package

theos will assume the existence of plutil which does not exist on Linux. and hence will crap out on

.theos/_ \( -name \*.plist -or -name \*.strings \) -exec plutil -convert binary1 {} \;
find: `plutil': No such file or directory

There is apparently a linux version called plistutil but theos doesn't pick the right one appropriately. I will try to fix this as well and submit upstream when have time.

The relevant code is line 12 of makefiles/package.mk

fxfactorial avatar Feb 24 '16 22:02 fxfactorial

Good catch. I'll wait for you to send a pull request.

kirb avatar Feb 24 '16 22:02 kirb

Maybe have a _THEOS_PLATFORM_PLUTIL on each makefiles/platform/*.mk?

uroboro avatar Feb 24 '16 22:02 uroboro

This will require another dependency on linux either way, being as plistutils is not installed by default, package name on ubuntu/debian is libplist-utils

jithatsonei avatar Mar 09 '16 23:03 jithatsonei

plutil isn't a builtin tool on iOS either so it requires Erica Utilities.

uroboro avatar Mar 10 '16 00:03 uroboro

(it didnt fix anything :(()

jithatsonei avatar Mar 11 '16 20:03 jithatsonei

Want to get this fixed, but plistutil (and Apple’s open source plconvert) is really awful to automate as it assumes you know what the input is and that the output you want is the opposite (so binary plist always becomes XML; XML/NeXT always becomes binary). I’ll have to add a script that checks the first few bytes of the file for the binary plist magic bytes bplist, and if not present then run plconvert.

kirb avatar Feb 22 '18 01:02 kirb

This is still unresolved, so let’s keep this open.

kirb avatar May 19 '20 04:05 kirb

I've created a somewhat decent wrapper for plistutil on linux (it can only convert) that could be used. It requires (on Arch) libxml2 and plistutil. Its here: https://gist.github.com/Finermeerkat137/e8119a8a8c82ab9c483ff3ccc2a5ea52

sunflsks avatar Oct 16 '20 15:10 sunflsks

That looks like a good workaround. Thanks for sharing! I’ll play around with a solution soon.

kirb avatar Oct 19 '20 11:10 kirb

Hi! I ran across this thread while Googling for the same thing myself. After looking at a few solutions for my own company (Screenplay) I decided to fork and iterate on a open-source, cross-platform, drop-in replacement for plutil:

https://github.com/screenplaydev/plutil

It's forked from Facebook's xcbuild (a tool developed by them to build xcode projects on Linux), but stripped down to just provide plist-editting functionality. That way you won't need to maintain separate code-paths for Mac and Linux environments.

Hope that's helpful!

tomasreimers avatar Mar 21 '21 18:03 tomasreimers

@tomasreimers That’s really useful, thanks! Too bad xcbuild was abandoned, there’s some solid work in there. Good to see people step up to maintaining forks of those tools.

In this case I’m thinking we may still just go ahead with using plistutil, with a wrapper script that looks for the bplist magic bytes to decide whether conversion is needed. Just easier for distribution this way, since Theos itself doesn’t actually ship any binaries, and libplist-utils should be in every distro.

kirb avatar Mar 21 '21 23:03 kirb

@tomasreimers That’s really useful, thanks! Too bad xcbuild was abandoned, there’s some solid work in there. Good to see people step up to maintaining forks of those tools.

In this case I’m thinking we may still just go ahead with using plistutil, with a wrapper script that looks for the bplist magic bytes to decide whether conversion is needed. Just easier for distribution this way, since Theos itself doesn’t actually ship any binaries, and libplist-utils should be in every distro.

Since plutil is a macOS exclusive and both plutil and plistutil require an accompanying script to check for the bplist bytes anyway, was the idea to move the conversion over to plistutil for all platforms?

It looks like it's already available on every platform Theos supports -- jailbroken iOS via Elucubratus/Procursus' respective repos, macOS via brew, and common Linux distros via their accompanying stable/extra repos.

L1ghtmann avatar Feb 07 '22 20:02 L1ghtmann

It would be ideal to just use plutil when it’s available to avoid an additional dependency when on macOS. iOS has sbingner’s plutil, which means the logic to support plistutil would only be required on Linux.

edit: I should clarify actually, it would just use one or the other based on what it finds in $PATH, so iOS with plistutil but no plutil would also work.

kirb avatar Feb 08 '22 11:02 kirb

Gotcha. Okay, I might try and implement some or all of that when I get some free time. Will make a pr if I make any progress

L1ghtmann avatar Feb 08 '22 23:02 L1ghtmann

Want to get this fixed, but plistutil (and Apple’s open source plconvert) is really awful to automate as it assumes you know what the input is and that the output you want is the opposite (so binary plist always becomes XML; XML/NeXT always becomes binary). I’ll have to add a script that checks the first few bytes of the file for the binary plist magic bytes bplist, and if not present then run plconvert.

plistutil has had -f for a while which can be used to force a specific output format.

0xallie avatar Oct 27 '22 13:10 0xallie

Fixed with c6da661

kirb avatar Oct 30 '22 04:10 kirb

plistutil has no support for NeXT style, so conversion from NeXT to binary will always fail.

I'm using WSL and got plutil.exe from the Apple Application Support folder in my path. It would be great if theos could use that instead, since it supports NeXT style just fine.

NoisyFlake avatar Nov 07 '22 09:11 NoisyFlake

I don't necessarily think adding explicit support for a platform-dependent tool is worthwhile when alternatives like ply exist and work on all of the platforms supported by theos.

If you want to continue to use the .exe over ply, I might recommend just creating an alias for plutil so no edits or symlinks are required for the conversion script to work as-is.

L1ghtmann avatar Nov 07 '22 16:11 L1ghtmann

I've actually created an alias for plutil, but the conversion script doesn't seem to care. Even though I get the alias when running command -v plutil manually, the script keeps telling me that no supported pl tool was found. I might give ply a try though.

NoisyFlake avatar Nov 07 '22 16:11 NoisyFlake

aliases don't work in scripts, you need to put a plutil wrapper binary somewhere in your PATH.

0xallie avatar Nov 07 '22 17:11 0xallie