-
Notifications
You must be signed in to change notification settings - Fork 528
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
Comments
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:
or
And run the script directly from your terminal. Then you can tell us the results please :) You will be the first tester :) |
The current scripts uses a lot more bash extensions than supported by busybox ash. You check that with shellcheck 0.10.0+ quit easily: Compatibility with more shells would only work when using a simpler standard like POSIX shell. |
@yusufdaglioglu when i put
|
|
@MagicalDrizzle Most of the fixes are trivial, I've got it down to five blocks of code that need a bit more thinking, |
@9ao9ai9ar I would be willing to be a tester for BusyBox. (plus the windows port and dash too for good measure) |
The rewrite focuses on the following five areas of interest: 1. Portability. The scripts should be useable across a number of Unix operating systems and shells; goes hand in hand with POSIX- compliance. 2. Robustness. Fail early; borrow from more battle-tested open source code; pass all valid ShellCheck checks. 3. Composability. Put everything inside functions; make the scripts dot source friendly. 4. Consistency. Abstract away terminal color codes with tput; uniform diagnostic messages and standardized use of status codes and redirections. 5. Readability. Extensive comments and descriptive names; use here- docs to ease writing multiline messages. Known behavioral changes: 1. Changed the way the options are parsed and acted on. For example, when both the -p and -l options of updater.sh are specified, -l will be ignored. The old behavior would depend on the order of the options passed, where the last one wins, and the profile path passed as the argument to -p couldn't be named 'list' or it would be treated as if the option -l was specified. 2. All temporary files are created using mktemp, so users won't find them in the working directory anymore should an error occur and they were not removed as a result of that.
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
The text was updated successfully, but these errors were encountered: