问题
I need to write a karaf console script that uninstalls a feature, if it is present on karaf 3.0.4.
So far I have not found any direct references mentionend in the documentation (https://karaf.apache.org/manual/latest-3.0.x/developers-guide/scripting.html). Using shell:env ?
always returns null
as the value and I'm not sure if ?
is a supported environment variable name in karaf.
So how can execute a karaf command if a feature is present?
回答1:
It is not possible to test if a feature is installed in a karaf console script in version 3.0.4. This is because the commands for scope feature do not return anything to the console (see the source code).
The workaround is to deploy another command to karaf that returns a boolean to the console and use this in a script.
来源:https://stackoverflow.com/questions/32076009/how-to-test-if-a-feature-is-installed-in-a-karaf-console-script