General TC > Programming & Scripting - Unofficial

Script to download extensions+dependencies on other Linux distros

<< < (4/9) > >>

xor:
I'm asking to understand the working logic!?

How do we call 32-bit dependencies on 64.bit!?

Juanito:
Everything is explained in the first post of this thread.

Rich:
I've attached an updated copy of  FetchExt.sh  to this post.

You can now enter multiple extensions in one command and it no longer matters whether or not you include
 .tcz  in the extension name:

--- Code: ---tc@E310:~/Scripting/FetchExtensions/tmp/debug$ ./FetchExt.sh 9vx xt_geoip_LE_IPv4 9vx.tcz xyzzy 915resolution.tcz xyzzy.tcz
..........
tc@E310:~/Scripting/FetchExtensions/tmp/debug$
--- End code ---
I replaced excess screen output with dots to indicate progress since the  Log.txt  file has a record of all activity anyway.

This is the log file from the above command:

--- Code: ---Sun Apr  3 22:34:50 UTC 2022
http://repo.tinycorelinux.net/10.x/x86/tcz/
Processing 9vx.tcz
9vx.tcz downloaded.
9vx.tcz.md5.txt downloaded.

Sun Apr  3 22:34:55 UTC 2022
http://repo.tinycorelinux.net/10.x/x86/tcz/
Processing xt_geoip_LE_IPv4.tcz
iptables.tcz downloaded.
iptables.tcz.md5.txt downloaded.
iptables.tcz.dep downloaded.
netfilter-4.19.10-tinycore.tcz downloaded.
netfilter-4.19.10-tinycore.tcz.md5.txt downloaded.
netfilter-4.19.10-tinycore64.tcz downloaded.
netfilter-4.19.10-tinycore64.tcz.md5.txt downloaded.
xt_geoip_LE_IPv4.tcz downloaded.
xt_geoip_LE_IPv4.tcz.md5.txt downloaded.
xt_geoip_LE_IPv4.tcz.dep downloaded.
xtables-addons-4.19.10-tinycore.tcz downloaded.
xtables-addons-4.19.10-tinycore.tcz.md5.txt downloaded.
xtables-addons-4.19.10-tinycore.tcz.dep downloaded.
  Error:  xtables-addons-4.19.10-tinycore64.tcz download failed.
  Error:  xtables-addons-4.19.10-tinycore64.tcz.md5.txt download failed.

Sun Apr  3 22:35:03 UTC 2022
http://repo.tinycorelinux.net/10.x/x86/tcz/
Processing 9vx.tcz
9vx.tcz already downloaded.

Sun Apr  3 22:35:04 UTC 2022
http://repo.tinycorelinux.net/10.x/x86/tcz/
  Error:  Processing xyzzy.tcz failed.

Sun Apr  3 22:35:04 UTC 2022
http://repo.tinycorelinux.net/10.x/x86/tcz/
Processing 915resolution.tcz
915resolution.tcz downloaded.
915resolution.tcz.md5.txt downloaded.

Sun Apr  3 22:35:05 UTC 2022
http://repo.tinycorelinux.net/10.x/x86/tcz/
  Error:  Processing xyzzy.tcz failed.
--- End code ---
The lines that begin with  Processing  refer to the extensions from the command line. That's what you add to
your onboot.lst  file,
The lines after that give the results for that extension and all dependencies.
Errors are indented for better visibility.

I've also attached a  ShowErrors.sh  script. It parses the Log.txt script created by FetchExt.sh and outputs a
formatted list of any errors found:

--- Code: ---tc@E310:~/Scripting/FetchExtensions/tmp/debug$ ./ShowErrors.sh

Sun Apr  3 22:34:55 UTC 2022
http://repo.tinycorelinux.net/10.x/x86/tcz/
Processing xt_geoip_LE_IPv4.tcz
Error:  xtables-addons-4.19.10-tinycore64.tcz download failed.
Error:  xtables-addons-4.19.10-tinycore64.tcz.md5.txt download failed.

Sun Apr  3 22:35:04 UTC 2022
http://repo.tinycorelinux.net/10.x/x86/tcz/
Error:  Processing xyzzy.tcz failed.

Sun Apr  3 22:35:05 UTC 2022
http://repo.tinycorelinux.net/10.x/x86/tcz/
Error:  Processing xyzzy.tcz failed.

tc@E310:~/Scripting/FetchExtensions/tmp/debug$
--- End code ---
The  xtables-addons  error shows that the 64 bit module extension is missing from the TC10 x86 repository.
The  Error:  Processing  message means the extension you requested from the command line does not exist.

The script now creates a list of kernel versions in the repo. If a kernel extension is needed, the script attempts to
download all kernel versions of that extension. Since the OS will load the correct version, it's just simpler that way.
PiCore sometimes has multiple versions. X86 supports core and core64, so we download both versions.

Remember to make the script make it executable:

--- Code: ---sudo chmod 777 FetchExt.sh
--- End code ---

Remember to edit the version and architecture variables to match your system:

--- Code: ---# User variables ***************************************************************

# Website to download from.
ADDR="http://repo.tinycorelinux.net"

# Tinycore version. Versions always end in  .x , there are no minor version digits.
TC="10.x"

# Processor architecture, current options are  x86  x86_64  armv6  armv7  armv7l  aarch64
ARCH="x86"

# End of user variables ********************************************************
--- End code ---

I think the script is fairly well documented if you want to see what's going on. Comments and criticism are welcome.

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

GNUser:
This is great, Rich. Thank you.

Just two comments:

1. == is a bashism, which leads to "unexpected operator" errors with the  /bin/sh  shebang (see https://mywiki.wooledge.org/Bashism). Changing every  [ "foo" == "bar" ]  in the script to  [ "foo" = "bar" ]  solves the problem.

2. The three  chown  steps require superuser privileges. It seems the two options are either to run the entire script as superuser or to change the three  chown  commands to  sudo chown  . I prefer doing as little as possible as superuser, so I went with the second option. The downside to my approach is that it is slightly less portable since not every user on every OS has  sudo  installed.

I will keep the script handy. I was using the old version to help me upgrade from one TCL version to the next, but this new version is even better :)

Rich:
Hi GNUser

--- Quote from: GNUser on April 06, 2022, 04:01:48 PM --- ... == is a bashism, which leads to "unexpected operator" errors ...
--- End quote ---
doctoranonymous reported the same issue in reply #8. I was not able to reproduce the issue (reply #11)
http://forum.tinycorelinux.net/index.php/topic,23034.msg146361.html#msg146361
I did a little searching and I think the correct syntaxes are:
[ "$1" = "info" ]  for strings.
[ $? -eq 0 ]  for integers (equal).
[ $? -ne 0 ]  for integers (not equal).

Could I ask you to change the tests of  $?  to the appropriate integer tests and see if that also fixes the error?

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version