diff options
author | Alejandro Sirgo Rica <asirgo@soleta.eu> | 2024-10-02 12:13:25 +0200 |
---|---|---|
committer | Alejandro Sirgo Rica <asirgo@soleta.eu> | 2024-10-02 14:25:04 +0200 |
commit | cc70274079a0de78497011e2c665838522b6e1f5 (patch) | |
tree | 5ce60b1203f392d0dacee9b593284b343eaf0991 /src/live | |
parent | a2baad8c0b62c1d0f4bc2a01c0f442899bd7475c (diff) |
src: check if the system is hibernated before /image/create
Mount the system partition in readonly mode and check for the
hiberfil.sys file if the target system is a Windows.
Fail the image creation process if the target system is hibernated.
Diffstat (limited to 'src/live')
-rw-r--r-- | src/live/ogOperations.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/live/ogOperations.py b/src/live/ogOperations.py index 74e4c09..83242d2 100644 --- a/src/live/ogOperations.py +++ b/src/live/ogOperations.py @@ -648,6 +648,16 @@ class OgLiveOperations: if not fstype: raise OgError(f'No filesystem detected in {padev}. Aborting image creation') + ro_mountpoint = padev.replace('dev', 'mnt') + if not mount_mkdir(padev, ro_mountpoint, readonly=True): + raise OgError(f'Cannot mount {ro_mountpoint} as readonly') + + try: + if is_hibernation_enabled(ro_mountpoint): + raise OgError(f'Target system in {padev} has hibernation enabled') + finally: + umount(ro_mountpoint) + if change_access(user=self._smb_user, pwd=self._smb_pass) == -1: raise OgError('remount of /opt/opengnsys/images has failed') |