-
Notifications
You must be signed in to change notification settings - Fork 117
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
Add -p option to mknod.c and use it with sys #2181
Conversation
Thanks @floriangit, well done! On a small code formatting note, would you mind changing the new if statements on lines 19-22 to match the existing formatting convention of using a space after the if, to match the rest of the file? Thank you. |
thanks! Added the spaces now. |
Thanks for enhancing |
one day I will rename |
It was initially suggested by someone, saying DOS used "sys" ... Obviously we're not emulating DOS here. What possible other names are you thinking? |
update, upgrade, install? After all it is now kind of an upgrader for me at least. |
then again, I thought it would be too tiresome to rename that now, since one has to know overall ELKS. Because grepping for |
I kind of like 'install'. The community has been used to 'sys' for more than a few years, but I would agree 'sys' only means something to folks familiar with DOS. Renaming ideas should probably be mentioned on #2157. |
Yes, I thought same. Since it's not (yet) anything like a self-hosted updater, it's still an installer involving two separate media, so install sounds good. |
I just realized that I think we have the new return value for the mknod -p option incorrect: instead of return 1 for the three cases, I think it needs to be return 0 (which means OK). A return 0 is an exit(0) which is interpreted by the shell as OK. Return 1 will stop shell execution if stop on errors is set (off by default). To test this, add Please test and let me know what you find, thanks! |
My line of thinking was that with -p returning 1 instead of 0: "The user asked me to preserve a file, but he also asked me to overwrite that file, so I indicate 1 instead of 0, so he has a chance to recognize my silent return". As for |
Thanks for pointing that out, I forgot about that. My current take is that running shell scripts without set -e is unsafe, unless any error is not important. In our case, the user will definitely want to know whether there was success or not in installation. Thus, set -e must be set. Next, the convention in shell scripts is a command returns "true" (no error) on exit/return 0, while "false" is anything else. A "false" return will stop the script execution if set -e is set. Thus our mknod -p must follow that convention. HOWEVER, since you've rightly pointed out that our design requires To your earlier points about writing a C program versus a shell script for installation or updating - our current method shows a weak point in the design which would be more easily handled in C. However, given the ease in scripting most of the solution, perhaps we should think of more/better ways to communicate between the kernel and shell scripts for installation issues, then take an overview design pass after we see what more might be required. |
Hi @ghaerr, Agreed first about Which made me step back. (Still agreeing on mknod -p to exit with 0): I would commit the return 0 for mknod -p next days and wait for thoughts. The general discussion re. |
See #2186 - the issue isn't what the sys script returns to the user, but rather halting the sys script on any error, but also allowing |
This replaces #2180 as per your suggestions. Using sys now even on a fully installed medium will now only output around 20 lines which fits to the old terminal sizes (80x25).