Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Updater.sh shell agnostic #1855

Open
asimovc opened this issue Jun 17, 2024 · 4 comments
Open

Make Updater.sh shell agnostic #1855

asimovc opened this issue Jun 17, 2024 · 4 comments
Labels

Comments

@asimovc
Copy link

asimovc commented Jun 17, 2024

My distros use busybox ash and the Updater.sh is using bash to work. I think making shell agnostic is better for just works in all systems.

Wha i expect is it just run as normal and i get this instead.

env: can't execute 'bash': No such file or directory

@yusuf-daglioglu
Copy link

Not all bash scripts are compatible with Shell: https://www.gnu.org/software/bash/manual/html_node/Shell-Compatibility-Mode.html

Therefore all script file should tested before run other interpreters.

But ash is a shell implementation. Most of OS put /bin/sh to reference to default interpreter (which in your case /bin/ash). So for temporary solution on your local machine you try to change first line:

https://github.com/arkenfox/user.js/blob/master/updater.sh#L1

as:

#!/bin/sh

or

#!/usr/bin/env sh

And run the script directly from your terminal. Then you can tell us the results please :) You will be the first tester :)

@sertonix
Copy link

sertonix commented Jul 9, 2024

The current scripts uses a lot more bash extensions than supported by busybox ash. You check that with shellcheck 0.10.0+ quit easily: shellcheck -s busybox -S error -e SC3036 *.sh

Compatibility with more shells would only work when using a simpler standard like POSIX shell.

@asimovc
Copy link
Author

asimovc commented Jul 10, 2024

@yusufdaglioglu when i put #!/usr/bin/env sh i get this

./updater.sh: line 20: syntax error: bad substitution
./updater.sh: line 21: syntax error: bad substitution

@MagicalDrizzle
Copy link

checkbashisms and shellcheck would be useful if anyone is willing to port the script. (former is just a perl script, latter is both cross-platform and has a browser version).
currently the script does make use of select which doesn't have any pure sh equivalent, so unfortunately it's not trivial...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

5 participants