hbang / NewTerm

NewTerm is a terminal emulator app with first-class iPhone, iPad, and Mac support.
https://newterm.app
Other
463 stars 71 forks source link

Can you use the Bash shell in NewTerm? #86

Closed YousufSSyed closed 1 year ago

YousufSSyed commented 1 year ago

I’m wondering this since Bash uses the GPLv3 license.

kirb commented 1 year ago

You can change shell with chsh.

YousufSSyed commented 1 year ago

Well I'm also wondering if newterm comes with / is packaged with Bash, since Bash uses the GPLv3 license and that's why the default shell in macOS changed to zsh.

kirb commented 1 year ago

The shells and other programs you can run come from separate packages, provided by Procursus or Elucubratus repos. The default shell on Procursus bootstrapped devices is zsh really more because of its far better usability over bash. GPL specifies that its viral licensing feature doesn’t apply to processes you spawn, so there’s no licensing concern. NewTerm also doesn’t directly know which shell it’s launching either, it calls login(1) which is responsible for reading that out of /etc/passwd.

YousufSSyed commented 1 year ago

It's been a long since I have jailbroken, what are packages again? Also, I'm not sure if you could answer this, but while Newterm is for jailbroken devices, how could Bash and Zsh work on Newterm but not on say, the A-Shell app? I asked at the repo here and the dev said that they've had trouble compiling programs like that.

Maybe this would be a question for them?

YousufSSyed commented 1 year ago

@kirb Ok I got an answer there but would you have anything to add / say?

kirb commented 1 year ago

Packages are what you install from repos, whether tweaks, apps, command line tools, etc. a-Shell and iSH are restricted in what they can do because of App Store and sandbox rules, which they manage to sidestep to a degree that’s usable enough through emulating a CPU. iSH then runs Alpine Linux on that, since that distro uses the Apache License which can be satisfied within Apple’s restrictions. I believe a-Shell uses Debian, which is supposed to be GPL-licensed (GPL is known to be incompatible with App Store rules), but if I understand right they’ve excluded all code licensed as GPL-only and only support what remains from there. Hence you lose access to many packages like GNU coreutils and bash in both apps, they get substituted with equivalent non-GPL packages like BSD coreutils and ash.

Jailbreak packages including NewTerm aren’t subject to any of these issues, because they run on “bare metal” (the code runs directly on the CPU, no emulation/virtualisation layer exists in between the code and the CPU), outside of the sandbox, and outside of the App Store platform, allowing these programs to run exactly as designed, and pretty much identically to what you’d get if you installed it on an Apple Silicon Mac. So there are no licensing issues, and (except in a handful of cases) fewer problems with compiling since it’s a fairly normal OS environment the original developers of these open-source projects intended to support.

NewTerm doesn't really actually do much on its own to make these programs work - it pretty much follows the same process a Mac or Linux terminal app uses to set up an interactive “login” shell environment. (In fact NewTerm 3 runs on macOS using the same codebase as on iOS!) The command line tools you’re using are provided and maintained by the Procursus and Elucubratus repos depending on jailbreak. iSH/a-Shell by comparison do a lot of heavy lifting, providing/maintaining all of the behind-the-scenes functionality like the emulator and the repository you’re installing packages from.

I hope that makes sense - I’ll close this since it isn’t an issue but please still feel free to ask any follow-up questions you may have here.