How to know if a script is running in dom0 or a qube?

I have a script that calls other scripts.

The script could be in a qube, or it could be in dom0.

If the script is in dom0, it needs to execute commands using qvm-run.

Is there anyway to know inside the script if the script is running in dom0 or in a qube?

This might be a bit hacky, but can you check for the dom0 username or existence of /home/<dom0_username>/ (assuming it’s distinct from any other qube username)?

if [ "$(hostname)" = dom0 ]