RFE: how about have a tool qm-is-ostree ?
I am wondering if we can convert this code into a generic tool for qm instead of exclusive for ffi and tests: https://github.com/containers/qm/blob/26ba84b3aaf83af045659aba4b3f71258b072d9b/tests/ffi/common/prepare.sh#L21
Why? I was looking into a way to test if we are into a ostree or not in a spec file and I couldn't easily do it. I am sure in the future, we might face another examples.
WDYT: @Yarboa @aesteve-rh @nsednev @RakeshMK90 @pengshanyu
If this issue get accepted by the maintainers, the engineer assigned could:
- convert the code from https://github.com/containers/qm/blob/26ba84b3aaf83af045659aba4b3f71258b072d9b/tests/ffi/common/prepare.sh#L21 into a tool and add into the dir tools/ (make sure the previous call use now the tool)
- make sure it included into rpm like others, see as example: https://github.com/containers/qm/blob/26ba84b3aaf83af045659aba4b3f71258b072d9b/rpm/qm.spec#L138
Hi, @dougsland we can perhaps do something like this in the spec file?
%pre
# Check if the system is an OSTree-based system
if [ -d /ostree/repo ] || command -v ostree >/dev/null 2>&1; then
echo "OSTree-based system detected."
# Perform any specific actions for OSTree systems if needed
else
echo "Non-OSTree system detected."
# Perform any actions specific to non-OSTree systems if needed
fi
The %pre scriptlet runs before the package is installed or upgraded
Hi, @dougsland we can perhaps do something like this in the spec file?
%pre # Check if the system is an OSTree-based system if [ -d /ostree/repo ] || command -v ostree >/dev/null 2>&1; then echo "OSTree-based system detected." # Perform any specific actions for OSTree systems if needed else echo "Non-OSTree system detected." # Perform any actions specific to non-OSTree systems if needed fiThe %pre scriptlet runs before the package is installed or upgraded
Indeed, it's a possible solution but I would prefer to have a tool available to users and developers as well to also quick go to shell or in a ssh-session and execute something like:
# qm-is-ostree
QM is running on OSTree-based system.
@RakeshMK90 WDYT?
thanks, @dougsland by tool you mean can we just create a separate bash script qm-is-ostree.sh and make it as an executable?. We are perhaps do this in setup part?
@RakeshMK90 no need to call in setup for now, just create a tool, also not required to add the extension .sh in the end as the shebang will help to automatic detect the type of file too. It can be added into the tools dir and in the spec it will deploy in /usr/share/qm/ see: https://github.com/containers/qm/tree/main/tools
Hi @dougsland created a MR here https://github.com/containers/qm/pull/614
Resolved.