Closed RVerhoeff closed 4 months ago
fyi, We have almost same utility which exists at https://github.com/fledge-iot/fledge/blob/develop/C/plugins/utils/cmdutil.cpp and to run the supported commands for fledge as root using setuid. As of now, only consumer is python. So not sure if we can merge into one utility or keep individual utilities for different works.
Is this required for any specific plugin?
@ashish-jabble , thanks for your feedback. I looked at the code for cmdutil and tried a few things. I have some comments:
For C++ programs, I think we would benefit from utilities created with the C run-time library so that creating command lines and spawning processes is not necessary. This Pull Request came out of my work on updating the S2OPCUA South plugin. Creating directories and copying files happens many times during startup but not while the plugin is actively processing data.
By the way, one of the error messages has a typo: insallation -> installation.
Thanks for the detailed info.
Environment variable FLEDGE_ROOT must be defined.
yeah this utility is only meant and worked inside FLEDGE_ROOT; as per initially requirements.
I just only want to share the existing stuff and this may only fit/worked with the specific scenarios moreover inside FLEDGE_ROOT.
If that does not meet your requirement, you can go ahead with the merge.
New file and directory routines are added in new files: