General TC > Programming & Scripting - Unofficial

Script to download extensions+dependencies on other Linux distros

<< < (7/9) > >>

GNUser:

--- Quote from: Rich on April 08, 2022, 09:32:22 AM ---I do want to keep the number of commands required as small and simple as possible just to
minimize the odds of weird stuff like this happening. Since I was just looking for some extra linefeeds, I'll add a few extra echos in place of the  \n  sequences.
--- End quote ---
I think  printf  is just as universal as  echo  but I agree with minimizing the number of required commands. Better to just use basic  echo  everywhere than use  echo  in some places and  printf  in others. Eliminating echo's  -e  option will do the trick.

Rich:
Hi GNUser
OK, fixed the echo commands in FetchExt.sh.

I also fixed a couple issues in ShowErrors.sh:
The read command was swallowing the 2 leading spaces from the lines beginning with Error:.
If the first entry in the Log.txt file was an error, its time stamp was ignored.

    [EDIT]: Attachments removed. A link to the current version is in the first post of this thread.  Rich

GNUser:
Hi, Rich. FetchExt.sh works perfectly now (tested in Devuan where /bin/sh is a symlink to dash). The script has already become indispensable to me--it horrifies me to think of doing a fresh TCL install or a TCL upgrade without it. Thank you so much for putting it together!

P.S. I did not test ShowErrors.sh. FetchExt.sh was written by Rich and tested by GNUser, so I don't expect there will be any errors to show ;D

-----
An echo postmortem:

I can understand a shell programmer having to be mindful of avoiding bashisms when writing a script for a Bourne shell (a.k.a. /bin/sh or sh) implementation. What I will never understand is why the different Bourne shell implementations can't agree to be compatible. echo is a shell built-in, so the issue here was that in TCL's version of sh (BusyBox ash),  echo  needs the  -e  flag to interpret escape sequences. In Devuan's version of sh (dash),  echo  does not have the  -e  option because it interprets escape sequences by default:

Forum error. See attached.

You'd be hard-pressed to find someone who loves shell scripting more than I do, but this kind of pitfall (i.e., ones resulting from compatibility-busting bickering between different  sh  implementations) sure is frustrating.

Rich:
Hi GNUser

--- Quote from: GNUser on April 09, 2022, 08:20:55 AM --- ... P.S. I did not test ShowErrors.sh. FetchExt.sh was written by Rich and tested by GNUser, ...
--- End quote ---
Then I hope you don't mind I included this at the top of the script:

--- Code: ---#!/bin/sh
# Script to download an extension and its dependencies written by Richard A. Rost July 7,2019
# Special thanks go out to GNUser for his time and effort spent testing and providing
# helpful suggestions and feedback.
#
--- End code ---


--- Quote --- ... so I don't expect there will be any errors to show ...
--- End quote ---
Always expect the unexpected. We have had the following issues in the repo, all of which will flag an error:
Missing  .md5.txt  file.
Incorrect md5sum in the  .md5.txt  file.
Listed dependency not in the repo.

Which brings me to my final update. I failed to provide the user with a yay or nay when the script finishes. :-[

No errors:

--- Code: ---tc@E310:~/Scripting/FetchExtensions/tmp/debug$ ./FetchExt.sh PicFormat abook ace-of-penguins acl
......................
OK


--- End code ---

Errors:

--- Code: ---tc@E310:~/Scripting/FetchExtensions/tmp/debug$ ./FetchExt.sh PicFormat abook xyzzy ace-of-penguins acl
......................
One or more errors occurred. See Log.txt after timestamp:
Sun Apr 10 16:43:16 UTC 2022


--- End code ---
Seems there's still no xyzzy extension in the repo.

The latest copies are attached here. I will remove the older versions and point the original post to here later on.

GNUser:
Hi, Rich. The acknowledgement is fine, but it was my pleasure to help. 99% of the time the two of us are involved, the help flows in the other direction...

It's amazing that you found a way to make this script even better!

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version