[FIX] hw_drivers: Fix unmount of cups folder
To add or modify printer the /root_bypass_ramdisks/etc/cups/ need be writeable. And /root_bypass_ramdisks/etc/cups/ = /etc/cups/ But when we make 'sudo mount -o remount,ro /' we put the /etc/cups/ and so /root_bypass_ramdisks/etc/cups/ folder on read-only. After all 'read-only' command we make another command to put cups folder writeable
This commit is contained in:
@@ -109,6 +109,7 @@ def load_certificate():
|
||||
Path('/root_bypass_ramdisks/etc/ssl/private/nginx-cert.key').write_text(result['private_key_pem'])
|
||||
subprocess.check_call(["sudo", "mount", "-o", "remount,ro", "/"])
|
||||
subprocess.check_call(["sudo", "mount", "-o", "remount,ro", "/root_bypass_ramdisks/"])
|
||||
subprocess.check_call(["sudo", "mount", "-o", "remount,rw", "/root_bypass_ramdisks/etc/cups"])
|
||||
subprocess.check_call(["sudo", "service", "nginx", "restart"])
|
||||
|
||||
def download_drivers(auto=True):
|
||||
@@ -127,6 +128,7 @@ def download_drivers(auto=True):
|
||||
zip_file = zipfile.ZipFile(io.BytesIO(resp.data))
|
||||
zip_file.extractall(get_resource_path('hw_drivers', 'drivers'))
|
||||
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:
|
||||
_logger.error('Could not reach configured server')
|
||||
_logger.error('A error encountered : %s ' % e)
|
||||
@@ -145,9 +147,11 @@ def unlink_file(filename):
|
||||
if path.exists():
|
||||
path.unlink()
|
||||
subprocess.check_call(["sudo", "mount", "-o", "remount,ro", "/"])
|
||||
subprocess.check_call(["sudo", "mount", "-o", "remount,rw", "/root_bypass_ramdisks/etc/cups"])
|
||||
|
||||
def write_file(filename, text):
|
||||
subprocess.check_call(["sudo", "mount", "-o", "remount,rw", "/"])
|
||||
path = Path.home() / filename
|
||||
path.write_text(text)
|
||||
subprocess.check_call(["sudo", "mount", "-o", "remount,ro", "/"])
|
||||
subprocess.check_call(["sudo", "mount", "-o", "remount,rw", "/root_bypass_ramdisks/etc/cups"])
|
||||
|
||||
@@ -140,11 +140,9 @@ class IoTboxHomepage(web.Home):
|
||||
|
||||
@http.route('/clear_credential', type='http', auth='none', cors='*', csrf=False)
|
||||
def clear_credential(self):
|
||||
subprocess.check_call(["sudo", "mount", "-o", "remount,rw", "/"])
|
||||
helpers.unlink_file('odoo-db-uuid.conf')
|
||||
helpers.unlink_file('odoo-enterprise-code.conf')
|
||||
subprocess.check_call(["sudo", "service", "odoo", "restart"])
|
||||
subprocess.check_call(["sudo", "mount", "-o", "remount,ro", "/"])
|
||||
return "<meta http-equiv='refresh' content='20; url=http://" + helpers.get_ip() + ":8069'>"
|
||||
|
||||
def get_wifi_essid(self):
|
||||
|
||||
Reference in New Issue
Block a user