I have separated and simplified an issue in my dom0 script.
Run test script in dom0:
#!/bin/bash
QVM="test-qube"
# create test qube
qvm-create ${QVM} --template debian-11 --label red
# test variable
qvm-run --pass-io --user user ${QVM} \
"VAR=123TEST"
# check VAR
qvm-run --pass-io --user user ${QVM} \
"echo VAR is: ${VAR}"
So what’s happening is that ${VAR} gets replaced with the value in dom0 before it’s passed to the qube. If VAR is not defined in dom0 nothing gets passed and the qube sees an empty "echo ".
The other problem you have is that the variable is transient. To be able to use it all uses have to be in the same qvm-run call. Think of it as a new shell being opened for each qvm-run call.
@whoami one possible solution here is to have all actions in a bash script that is stored somewhere in dom0, then qvm-copy-to-vm it into the target qube, make it executable and run it. Good luck!
#!/bin/bash
# make a new (default) qube or use any standard AppVM (curl must be installed)
QVM="my-new-qube"
#URI_APPIMAGE="https://mail.tutanota.com/desktop/tutanota-desktop-linux.AppImage"
URI_APPIMAGE="https://releases.threema.ch/web-electron/v1/release/Threema-Latest.deb"
# get the file size (in MB)
qvm-run --no-gui --pass-io --quiet --user user ${QVM} \
"APPIMAGE_SIZE=\$(curl --silent --head --location ${URI_APPIMAGE} | \
grep --ignore content-length | \
sed s/[^0-9]//g | \
numfmt --to=si |& tail -1) && \
echo ...this is the file size: \${APPIMAGE_SIZE} && \
echo of ${URI_APPIMAGE}"
… one step further
I hope I reach a phase soon to share my script with you. It will include examples of add key-repo, install deb (directly), install AppImages … There are still many ideas and “#TODO” listed in my code …