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/utils/probe.py | |
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/utils/probe.py')
-rw-r--r-- | src/utils/probe.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/utils/probe.py b/src/utils/probe.py index 2ed029b..e53f08f 100644 --- a/src/utils/probe.py +++ b/src/utils/probe.py @@ -178,3 +178,10 @@ def os_probe(mountpoint): return getwindowsversion(winreghives) else: return 'unknown' + +def is_hibernation_enabled(mountpoint): + if get_os_family(mountpoint) != OSFamily.WINDOWS: + return False + + hiberfile_path = f'{mountpoint}/hiberfil.sys' + return os.path.exists(hiberfile_path) |