Tiny Core Base > TCB Q&A Forum

How to automate removal of leftover unneeded dependencies?

(1/3) > >>

nitram:
coreplayer2 nicely summarized how to remove TC applications - thanks:
http://forum.tinycorelinux.net/index.php/topic,17584.0.html

--- Quote ---Simply use Apps   to remove programs

Open Apps, select  Apps button > Maintenance >  Dependencies and Deletions, wait for the list of installed extensions to be built, then,
Select the Extension you wish to remove, while highlighted go up to the Dependencies button and choose "Mark for deletion"  the extension will be listed in the right window along with any errors messages regarding dependencies..
Next select the Dependencies button > Exit Dependency check> close Apps, Apps button > Quit, then reboot

Sounds a little complex when is written but is actually quite easy when you get the routine down.
--- End quote ---

No problem. My query is related to removing leftover dependencies that are no longer needed.

I can manually check which dependencies were required for the application that was just removed, then attempt to Mark for Deletion these dependencies and Apps will either mark for deletion or failsafe notify if not possible as another application depends on it. That's fine but the manual method is tedious, especially after installing/removing several packages.

Another method would be to process the whole installed list one item at a time, then click Dependencies drop down, then Mark for Deletion and Apps either marks or warns, also very tedious. Would be great if there was a keyboard shortcut to quicken this process, like del key, instead of all the menu clicking.

Via Apps > Maintenance > Dependencies and deletions i tried shift, ctrl and ctrl-a in an attempt to select the entire list hoping to flag all unneeded dependencies at once but this doesn't work. In hindsight, Apps isn't designed to work this way because all primary packages will get removed with their dependencies and the optional folder will be gutted.

The last alternative i can think of would be to delete the optional folder contents and essentially start with a fresh system, reinstalling only desired applications - starting from scratch.

Any way to automate removal of leftover unneeded dependencies? Sorry if this has been brought up before, didn't find anything.

gerald_clark:
Apps automatically removes any dependencies that are not needed by another app.

nitram:
Thanks gerald_clark.

Sorry about that, should have RTFreeM   :-[

For others like me:

--- Quote ---The other function, extension deletion, allows you to mark an
extension to be deleted on the next reboot. All of their dependencies
that aren’t needed by anything else will also be removed.

--- End quote ---
Page 56 of 163
Into the Core - A look at Tiny Core Linux

CentralWare:
@nitram: There's one teeency flaw with dependency assumptions we've encountered.

Let's say we have a web development box which under most distros we would install LAMP.
For CentOS (for example) the apps list would be:
apache2 php5 mysql mysql-server and a few other odds and ends.
I mistakenly took the same approach with TC
apache2 php5 mysql-client mysql and again, a few other oddities.
What I didn't know is that php5 claims MySQL as being a dependency.  You could imagine my surprise when I used a script for general installation (tce-load -wi $app_list) and then later removed php5 as it wasn't needed for THAT specific project, but MySQL was needed...  come to find out my SQL server disappeared! :)

Imagine looking at extensions based on their download: If you tce-load a given app such as php5 you could call this the "parent" extension and all dependencies listed within the file.tcz.dep as children.  With the PHP-MySQL scenario, one or more of the children are also parents in some instances.  There's a ton of legitimate examples which would likely fall into this category.

What we have on the white-board in the not so distant future is a separate file (similar to onboot.lst) which flags files which are specifically requested in tce-load where if you specifically request a file, it's considered a parent, thus when removing an extension, if a dependency is found within this new file, it's left alone - along with any of ITS dependencies.  This requires a little bit of a rewrite of tce-load so once finished and perfected we'll be submitting it here for consideration to be implemented into the core.

As for a clean slate as you noted, we already have a method which is relatively tried and tested which helps with this kind of maintenance.  We have our own TCL mirror in-house so it will be more convenient (and faster) when we're using it, but even "live" it should be a good alternative assuming any updates which have been made to the live repository are functional.

1) Create a static file somewhere (we persist /opt, so that's where most of our functions like this are placed) such as /opt/.extensions and within this file list all of the extensions you want to have "always installed" and maintained.  I'm going to use the basic TinyCore approach for the example:
/opt/.extensions

--- Code: ---Xvesa
Xprogs
flwm_topside
wbar

--- End code ---

2) Create a small script to run the show
/opt/extensions.sh (chmod +x)

--- Code: ---#!/bin/sh
exts=`cat /opt/.extensions`
for ext in $exts
do
     ext=${ext/.tcz/} # Remove the .tcz extension if it's in the item
     if [ ! -d /tmp/tcloop/$ext ]; then
          # The extension isn't installed and/or loaded #
          echo "Installing extension [$ext]"
          su -c "tce-load -wi $ext" tc
     fi
done

--- End code ---
There are a few assumptions involved here, such as networking is up and running, the machine itself HAS internet or network access by the time it runs AND that the extension(s) listed were intended for install-and-boot.

When ever you need to clean out the closet, simply delete tcedir/optional, onboot.lst and on-demand if it's used, then reboot.  If you don't want to reboot, also empty the /usr/local/tce.installed directory, kill all post-boot processes and then run the script.  Rebooting is the cleanest method, though, as many times apps create files/directories elsewhere which may no longer be in their default state.  We're working on this problem, too (where in the end we'll be able to call a "reformat" program which basically takes the machine back to a clean boot without the need for rebooting, which should be about 98% efficient as there might be a small amount of memory loss from less-than-efficient programs which had been running previously and didn't die gracefully.)

core-user:

--- Quote ---We're working on this problem, too (where in the end we'll be able to call a "reformat" program which basically takes the machine back to a clean boot without the need for rebooting
--- End quote ---
I certainly would not call it "reformat" - you will scare people, who will think they are going to lose all their data!  ;)

Navigation

[0] Message Index

[#] Next page

Go to full version