base
base copied to clipboard
Add remove-tool command
remove-tool fooremoves all installations of toolfooremove-tool foo x.y.zremoves installation of[email protected]- If another version of
foois still installed then it needs to be linked instead
- If another version of
What if there are more than 2 versions installed? Which version should be linked?
Should it support the <TOOL>_VERSION env variable like install-tool ?
What if there are more than 2 versions installed? Which version should be linked?
It's much easier to simply unlink the tool. 🤔
//cc @nabeelsaabna @Gabriel-Ladzaretti
It seems it much more tricky.
I can easily remove a version, if it's not the linked one (latest installed).
If i remove a node version which is the linked one, i don't now if the linked npm or corepack is from this node install or installed by the tool after node was installed. 🤔
Unlink is not good. the main idea is to delete the file and reduce vulnerabilities in the final image.
It seems it much more tricky.
I can easily remove a version, if it's not the linked one (latest installed).
If i remove a node version which is the linked one, i don't now if the linked npm or corepack is from this node install or installed by the tool after node was installed. 🤔
That does complicate things 😕
Is it only an issue for node and npm ?
python as well ?
maybe also deleting Java can break maven and/or Gradle ?
yes, same for python and java.
python, node and ruby based tools are dependent on the ruby version which was linked when installed. so removal of node or ruby can break npm, bundler, pip, ...
https://github.com/containerbase/base/blob/acbf0913cf2915886c52b1b0c3fe112b7bf9609f/src/cli/tools/node/utils.ts#L103
https://github.com/containerbase/base/blob/acbf0913cf2915886c52b1b0c3fe112b7bf9609f/src/cli/tools/python/utils.ts#L50
Some points I remember:
- Needs to remove the tools. e.g. remove older dotnet while keeping newer
- Maybe we could say that "delete-tool foo x.y.z" is only supported if x.y.z isn't the linked one?
Some points I remember:
- Needs to remove the tools. e.g. remove older dotnet while keeping newer
- Maybe we could say that "delete-tool foo x.y.z" is only supported if x.y.z isn't the linked one?
that would be much easier
uninstall-tool node will uninstall all versions which are not linked.
It'll still be easy to break tools, eg:
- install python 3.9
- install poetry xx
- install python 3.10
- uninstall python 3.9
poetry will be broken because it's installed into a virtualenv which uses a symlink to use the proper python version.
so users should always reinstall tools like poetry when they installed a new python version. that's a requirement for now.
we would need a kind database to track those dependencies. then we would be able to do a better cleanup. it would then be possible to also remove linked tools and all poetry, pip, ... versions which depend on the currently removed python version. we could also simply abort with a warn, that you need to uninstall poetry to uninstall python.
I'll add some minimal db handling to store the relevant data, so the uninstall tool can use the information for better removal.
Removing legacy tools won't be possible, thex need to be convertet first.
That are all tools in this folder and subfolders: https://github.com/containerbase/base/tree/main/src/usr/local/containerbase/tools
v2 are legacy and not possible to remove? Or v2 are the ones possible to remove?
v2 are legacy and not possible to remove? Or v2 are the ones possible to remove?
to complicated to implement, it's easier to convert them to TS code.
when I'm done with, I'll check if I can support B2 tools