@@ -198,6 +198,10 @@ def is_google_chrome_installed():
198198 import shutil
199199 return shutil .which ("google-chrome" ) is not None
200200
201+ def is_package_installed (package ):
202+ import shutil
203+ return shutil .which (package ) is not None
204+
201205def install_chrome (uname ):
202206 if is_google_chrome_installed ():
203207 return
@@ -504,11 +508,17 @@ def install_desktop_app_in_vm(
504508 default_name = get_filename_from_url (debian_installer_url )
505509
506510 delete_installer (default_name )
511+
512+
513+
507514 subprocess .run (["wget" , debian_installer_url ], check = True , stderr = subprocess .STDOUT )
508- install_command = f"sudo apt --fix-broken install ./{ default_name } -y"
509- subprocess .run (install_command , shell = True , check = True , stderr = subprocess .STDOUT )
510515 package_name = subprocess .check_output (f"dpkg-deb -f ./{ default_name } Package" , shell = True ).decode ().strip ()
511- delete_installer (default_name )
516+ if is_package_installed (package_name ):
517+ install_command = f"sudo dpkg -i ./{ default_name } "
518+ else :
519+ install_command = f"sudo apt --fix-broken install ./{ default_name } -y"
520+ subprocess .run (install_command , shell = True , check = True , stderr = subprocess .STDOUT )
521+
512522
513523 # Create systemd service for Xvfb
514524 xvfb_service_name = f"xvfb.service"
@@ -637,7 +647,7 @@ def wait_till_desktop_api_up(ip, api_base_path):
637647 time .sleep (interval )
638648 # If the function hasn't returned after the loop, raise an exception
639649 raise Exception (
640- f" The Desktop Api at http://{ ip } { api_base_path or '/' } is not running. You have surely forgotten to enable the Api in api-config.ts."
650+ f' The Desktop Api at http://{ ip } { api_base_path or "/" } is not running. You have surely forgotten to enable the Api in " api-config.ts".'
641651 )
642652
643653# python -m bota.vm
0 commit comments