OpenRepeater / scripts

Misc scripts live here like system build scripts. This is a Work-In-Progress...
5 stars 9 forks source link

STDERR Capture and two other fixes #27

Closed bobruddy closed 5 years ago

bobruddy commented 5 years ago

This resolves #25 by capturing STDERR in the normal log. I also store only STDERR in a separate error log. This allows quick review of issues.

In reviewing the new error log that I found that the Relay Module install was failing. I logged this in #26 and this has that fix as well. Details are in the #26 issue.

In addition there was a lot of warns from the "apt" command. Apparently for scripted activities it is recommended that we use "apt-get" instead which has output that is more aligned with scripting. See this thread for details https://askubuntu.com/questions/990823/apt-gives-unstable-cli-interface-warning

bobruddy commented 5 years ago

I can re-submit with a change back to apt, but I changed it to apt-get because after capturing STDERR there was seven warnings that we should not be using "apt" in scripts. This is the error

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

In my research on this I found this at the top of the description in the debian stretch documentation for apt which implies apt is for interactive use and apt-get is for scripted use. https://manpages.debian.org/stretch/apt/apt.8.en.html

apt provides a high-level commandline interface for the package management system. It is intended as an end user interface and enables some options better suited for interactive usage by default compared to more specialized APT tools like apt-get(8) and apt-cache(8).

Here is another thread on it. With the following excerpt as an example. Now we aren't parsing the output, but it could give odd results in the log files that might be difficult to make sense of if there is an error. https://askubuntu.com/questions/990823/apt-gives-unstable-cli-interface-warning

apt's output is not well useable in scripts. For example, apt install (compared to apt-get install) displays a progress bar that's useless for scripts and can throw errors when the output is parsed. apt show firefox shows a hint for an additional record, which is also totally useless in a script, you want it to simply output every record there – that's what apt-cache show firefox does. Let's see what man apt has to say about that:

Anyway good either way. Just let me know and I can remove this one.

abcrawford commented 5 years ago

I manual had added the changes for the log output that you had suggested. There are now some conflict with the pull request that prevent me from merging it. Based on your research I am OK with changing apt to apt-get if that is better suited and will remove the errors.