diff options
author | Tomeu Vizoso <tomeu@tomeuvizoso.net> | 2007-12-13 12:13:33 (GMT) |
---|---|---|
committer | Tomeu Vizoso <tomeu@tomeuvizoso.net> | 2007-12-13 12:13:33 (GMT) |
commit | ebcfbcedc2521c89bf60f0200ef02d70da82861a (patch) | |
tree | dda8a3ebb5a254a9f3502cda0dae1dec00c00d03 /shell | |
parent | 7ad5cf30633c25a846adb8c995416af8d04d3939 (diff) |
In case of error when mounting the DS, move the existing data and start a clean one. (neuralis)
Diffstat (limited to 'shell')
-rw-r--r-- | shell/view/Shell.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/shell/view/Shell.py b/shell/view/Shell.py index b9d259f..72aa3b1 100644 --- a/shell/view/Shell.py +++ b/shell/view/Shell.py @@ -20,6 +20,7 @@ import logging import tempfile import os import time +import shutil import gobject import gtk @@ -80,8 +81,16 @@ class Shell(gobject.GObject): def _start_journal_idle(self): # Mount the datastore in internal flash - datastore.mount(env.get_profile_path('datastore'), [], - timeout=120 * DBUS_PYTHON_TIMEOUT_UNITS_PER_SECOND) + ds_path = env.get_profile_path('datastore') + try: + datastore.mount(ds_path, [], timeout=120 * \ + DBUS_PYTHON_TIMEOUT_UNITS_PER_SECOND) + except: + # Don't explode if there's corruption; move the data out of the way + # and attempt to create a store from scratch. + shutil.move(ds_path, os.path.abspath(ds_path) + str(time.time())) + datastore.mount(ds_path, [], timeout=120 * \ + DBUS_PYTHON_TIMEOUT_UNITS_PER_SECOND) # Checking for the bundle existence will also ensure # that the shell service is started up. |