vm-upload must be run as user root

This commit is contained in:
Raphael Dannecker 2024-02-05 12:59:23 +01:00
parent ccec0f7fea
commit d285b9dbf0
5 changed files with 7 additions and 19 deletions

View file

@ -16,7 +16,7 @@ upload_image() {
echo "File not found ${VM_NAME}.qcow2" >&2
exit 1
fi
sudo vm-aria2 stop "${VM_NAME}" || echo "VMImage-torrent not running"
vm-aria2 stop "${VM_NAME}" || echo "VMImage-torrent not running"
# link private VM-Diskimage to system-Dir
if [[ -f "${VM_DIR}/${VM_NAME}.qcow2" \
&& ( -f "${VM_SYSDIR}/${VM_NAME}.qcow2" && ("${VM_DIR}/${VM_NAME}.qcow2" -nt "${VM_SYSDIR}/${VM_NAME}.qcow2") \
@ -26,6 +26,9 @@ upload_image() {
ln -f "${VM_DIR}/${VM_NAME}.qcow2" "${VM_SYSDIR}/${VM_NAME}.qcow2"
fi
cd "${VM_SYSDIR}"
if [[ -f "/tmp/${VM_NAME}.qcow2.torrent" ]]; then
rm -f "/tmp/${VM_NAME}.qcow2.torrent"
fi
uploadseed --server "${SEEDBOX_HOST}:${SEEDBOX_RPC_PORT}" --dht-port "${SEEDBOX_PORT}" \
--pwdfile "${SEEDBOX_PWFILE}" --no-cert "${VM_NAME}.qcow2"
}