WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: tce-catload, tce-umount  (Read 2698 times)

Offline polikuo

  • Hero Member
  • *****
  • Posts: 714
tce-catload, tce-umount
« on: March 23, 2018, 01:52:00 AM »
Hello there all  :D

There have been ideas regarding to unloading an extension without rebooting.
There are several unofficial scripts on the forum that removes tcloops,
but they are designed for older TC versions leaving them potentially unreliable.

I know TC is not designed this way and it would likely leave your system unstable.
However, it won't hurt to try right ?  ;)
Guess what ?
CHALLENGE ACCEPTED !!

I spend a few days pondering, searching for posts, etc.
After a few trails, I manage to brew up scripts that can handle the task.
Ladies and gentlemen, may I present to you ... tce-catload & tce-umount  8)

Note that these scripts are still in development.
There might be bugs somewhere, but they works fairly well for me.
If you decide to help test, then please test carefully.
I don't want anyone to lose data. (though unlikely  :-X)

*General idea:
  you load a extension with tce-catload
  you use the extension
  you get bored and want to unload it
  you remove the extension with tce-umount

*How to:
Code: [Select]
tce-catload [-f|-h|-s|--help] tcz_name1 tcz_name2 ...tce-catload stands for TC extensions catalog load.
i.e. it performs "tce-load -i TCZ" and documents the results.

Code: [Select]
tce-umount [-f|-h|-s|--help] tcz_name1 tcz_name2 ...It unmounts TC extensions along with the documented dependencies.

*Features:
It skips extensions you want to keep as long as you have them cataloged.
For instance, you want to catalog both binutils and compiletc.
Just run tce-catload binutils compiletc.
When you do tce-umount compiletc, binutils is untouched.
On the other hand, if you try to unload binutils, nothing happens cause binutils is a dependence of compiletc.
Note that the order of the arguments is not much of a big deal as they are calculated before loading.  ???
However, tce-catload binutils compiletc runs faster than tce-catload compiletc binutils cause it saves loops of checking.
The same idea applies for tce-umount, but in reverse.
i.e. tce-umount compiletc binutils runs faster than tce-umount binutils compiletc.

*Limitations:
There's no way I can reverse the modifications done by tce.installed script.
Some extra files may remain there.

*Examples:
I'm using gawk and bash for demonstration.
Both gawk and bash depends on readline.
Code: [Select]
tc@box:~$ tce-catload gawk bash
readline.tcz: OK
gmp.tcz: OK
mpfr.tcz: OK
gawk.tcz: OK
:1 gawk

bash.tcz: OK
:2 bash

The extensions are loaded normally via "tce-load -i".
You can find the catalog file at /var/log/tce-tool/cata.log,

Assume that you don't want to keep bash around, just type.
Code: [Select]
tc@box:~$ tce-umount bash
Warning, the X server is running, type "force" to ignore.
force
Unloading bash.tcz ... OK
Now bash is unmounted  :)
In case you have a running X server, the script pause for confirmation.
If you'd rather ignore it, type "force" or use the "-f" option in prompt.

*Overlapping dependencies:
What if I wanna get rid of gawk instead ?
No worries, my script handles the dependencies.
Code: [Select]
tc@box:~$ tce-umount -f gawk
Unloading gawk.tcz ... OK
Unloading mpfr.tcz ... OK
Unloading gmp.tcz ... OK
When you open the catalog file, you'll see
Quote
readline
bash
:1   bash

As you can see, readline is preserved and is now logged along with bash.

*When error occurs:  :(
If tce-catload failed to load an extension for whatever reason,
it create an entry for the last successfully mounted extension.
This entry is a makeshift one and should be unloaded immediately.

tce-umount checks if the loop device is unmountable before unmounting.
It should be safe, but if it failed while unmounting, it reloads back to previous stage.
After you shut down every processes in used for the extension, you can give it another shot.

*Quick summary:
For a tcz to be unmountable by the tool, use "tce-catload" instead of "tce-load -i".
To unload the extension, run "tce-umount".

Feedbacks are welcome  :D