diff --git a/addons/hw_drivers/tools/helpers.py b/addons/hw_drivers/tools/helpers.py index 5641f46b8b3..225c0ea3599 100644 --- a/addons/hw_drivers/tools/helpers.py +++ b/addons/hw_drivers/tools/helpers.py @@ -79,8 +79,8 @@ def check_git_branch(): if db_branch != local_branch: subprocess.check_call(["sudo", "mount", "-o", "remount,rw", "/"]) - subprocess.check_call(["rm", "/home/pi/odoo/addons/hw_drivers/iot_handlers/drivers/*"]) - subprocess.check_call(["rm", "/home/pi/odoo/addons/hw_drivers/iot_handlers/interfaces/*"]) + subprocess.check_call(["rm", "-rf", "/home/pi/odoo/addons/hw_drivers/iot_handlers/drivers/*"]) + subprocess.check_call(["rm", "-rf", "/home/pi/odoo/addons/hw_drivers/iot_handlers/interfaces/*"]) subprocess.check_call(git + ['branch', '-m', db_branch]) subprocess.check_call(git + ['remote', 'set-branches', 'origin', db_branch]) os.system('/home/pi/odoo/addons/point_of_sale/tools/posbox/configuration/posbox_update.sh') @@ -209,8 +209,9 @@ def download_iot_handlers(auto=True): resp = pm.request('POST', server, fields={'mac': get_mac_address(), 'auto': auto}) if resp.data: subprocess.check_call(["sudo", "mount", "-o", "remount,rw", "/"]) + drivers_path = Path.home() / 'odoo/addons/hw_drivers/iot_handlers' zip_file = zipfile.ZipFile(io.BytesIO(resp.data)) - zip_file.extractall(get_resource_path('hw_drivers', 'iot_handlers')) + zip_file.extractall(drivers_path) subprocess.check_call(["sudo", "mount", "-o", "remount,ro", "/"]) subprocess.check_call(["sudo", "mount", "-o", "remount,rw", "/root_bypass_ramdisks/etc/cups"]) except Exception as e: