2024-08-17 12:18:59 -06:00
from subprocess import Popen , PIPE
2024-08-17 17:07:48 -06:00
import os
user = os . getlogin ( )
image = f " /home/ { user } /safe/debian.qcow2 "
initialize = [
" qemu-system-x86_64 " ,
" -enable-kvm " ,
2024-08-17 17:22:29 -06:00
" -m " , " 2G " , # ram allocation
" -nic " , " user,hostfwd=tcp::5555-:22 " , #forward port 5555 in host to port 22 in vm
2024-08-17 17:07:48 -06:00
" -drive " , " file= %s ,media=disk,if=virtio " % image ,
2024-08-17 17:22:29 -06:00
# "-nographic",
# "-serial", "mon:stdio",
2024-08-17 17:07:48 -06:00
2024-08-17 17:22:29 -06:00
" -vga " , " virtio " , # i think this fixes resolution but idk yet
" -display " , " sdl " ,
]
2024-08-17 17:07:48 -06:00
2024-08-17 17:22:29 -06:00
#Popen(["cp", "/home/chopper/safe/debian.qcow2", f"/home/{user}/nnnnndebian.qcow2"]) #copy the base image to a directory with everyones virtual machines.
Popen ( initialize )
2024-08-17 12:18:59 -06:00