refs #1101 improve ogGetImageInfo() a bit
parent
38cb5ab986
commit
e8f7996470
|
@ -214,6 +214,7 @@ def ogGetImageInfo (imgfile):
|
||||||
os.environ['LC_ALL'] = 'C'
|
os.environ['LC_ALL'] = 'C'
|
||||||
partclone_info = subprocess.run (['partclone.info', filehead], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True).stdout
|
partclone_info = subprocess.run (['partclone.info', filehead], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True).stdout
|
||||||
#partclone_info = subprocess.run (['cat', '/tmp/foo-partclone'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True).stdout
|
#partclone_info = subprocess.run (['cat', '/tmp/foo-partclone'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True).stdout
|
||||||
|
## sacado de un email de alberto garcía uma.es
|
||||||
#Partclone v0.3.13 http://partclone.org
|
#Partclone v0.3.13 http://partclone.org
|
||||||
#Unknown mode
|
#Unknown mode
|
||||||
#File system: NTFS
|
#File system: NTFS
|
||||||
|
@ -254,22 +255,34 @@ def ogGetImageInfo (imgfile):
|
||||||
|
|
||||||
if False == imgdetect and not os.path.exists ('/dev/loop2'):
|
if False == imgdetect and not os.path.exists ('/dev/loop2'):
|
||||||
filehead_contents = Path (filehead).read_bytes()
|
filehead_contents = Path (filehead).read_bytes()
|
||||||
ntfscloneinfo = ''
|
|
||||||
if b'ntfsclone-image' in filehead_contents:
|
if b'ntfsclone-image' in filehead_contents:
|
||||||
print (f'shelling out "cat {filenead} | ntfsclone --restore --overwrite /dev/loop2 - 2>&1"')
|
print (f'shelling out "cat {filenead} | ntfsclone --restore --overwrite /dev/loop2 - 2>&1"')
|
||||||
ntfscloneinfo = subprocess.run (f'cat {filenead} | ntfsclone --restore --overwrite /dev/loop2 - 2>&1', shell=True, capture_output=True, text=True).stdout
|
ntfscloneinfo = subprocess.run (f'cat {filenead} | ntfsclone --restore --overwrite /dev/loop2 - 2>&1', shell=True, capture_output=True, text=True).stdout
|
||||||
#ntfscloneinfo = subprocess.run (['cat', '/tmp/foo-ntfsclone'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True).stdout
|
#ntfscloneinfo = subprocess.run (['cat', '/tmp/foo-ntfsclone'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True).stdout
|
||||||
|
## sacado de claude 3 haiku
|
||||||
|
#ntfsclone v2023.4.0 (libntfs-3g)
|
||||||
|
#NTFS volume version: 3.1
|
||||||
|
#Cluster size: 4096 bytes
|
||||||
|
#Image volume size: 104857600 bytes (105 MB)
|
||||||
|
#Space in use: 52428800 bytes (52 MB)
|
||||||
|
#Reading and restoring NTFS...
|
||||||
|
#100.00 percent completed
|
||||||
|
#Syncing ...
|
||||||
|
#Successfully cloned image to device '/dev/loop2'.
|
||||||
|
else:
|
||||||
|
ntfscloneinfo = ''
|
||||||
|
|
||||||
if 'ntfsclone' in ntfscloneinfo:
|
if 'ntfsclone' in ntfscloneinfo:
|
||||||
tools = 'NTFSCLONE'
|
tools = 'NTFSCLONE'
|
||||||
m = re.search (r'__TODO__ *: *(\S+)', ntfscloneinfo) ## TODO
|
m = re.search (r'Image volume size *: *(\S+)', ntfscloneinfo)
|
||||||
size = 42 #float (m.group(1))/1000 if m else 0 ## TODO
|
size = float (m.group(1))/1000 if m else 0
|
||||||
fs = 'NTFS'
|
fs = 'NTFS'
|
||||||
imgdetect = True
|
imgdetect = True
|
||||||
|
|
||||||
if False == imgdetect:
|
if False == imgdetect:
|
||||||
partimageinfo = subprocess.run (['partimage', '-B', 'gui=no', 'imginfo', filehead], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True).stdout
|
partimageinfo = subprocess.run (['partimage', '-B', 'gui=no', 'imginfo', filehead], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True).stdout
|
||||||
#partimageinfo = subprocess.run (['cat', '/tmp/foo-partimage'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True).stdout
|
#partimageinfo = subprocess.run (['cat', '/tmp/foo-partimage'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True).stdout
|
||||||
|
## sacado de un email de alberto garcía uma.es
|
||||||
#Volume number:.........0
|
#Volume number:.........0
|
||||||
#Volume size:...........1,27 MiB
|
#Volume size:...........1,27 MiB
|
||||||
#Compression level: ....0 -> ninguno
|
#Compression level: ....0 -> ninguno
|
||||||
|
@ -285,9 +298,7 @@ def ogGetImageInfo (imgfile):
|
||||||
#Compatible Version:....0.6.1
|
#Compatible Version:....0.6.1
|
||||||
#Encryption algorithm:..0 -> ninguno
|
#Encryption algorithm:..0 -> ninguno
|
||||||
#MBR saved count:.......0
|
#MBR saved count:.......0
|
||||||
print (f'partimageinfo bef ({partimageinfo})')
|
|
||||||
partimageinfo = re.sub (r':\s*\.+', ' : ', partimageinfo)
|
partimageinfo = re.sub (r':\s*\.+', ' : ', partimageinfo)
|
||||||
print (f'partimageinfo aft ({partimageinfo})')
|
|
||||||
if 'Partition' in partimageinfo:
|
if 'Partition' in partimageinfo:
|
||||||
tools = 'PARTIMAGE'
|
tools = 'PARTIMAGE'
|
||||||
m = re.search (r'Filesystem *: *(\S+)', partimageinfo)
|
m = re.search (r'Filesystem *: *(\S+)', partimageinfo)
|
||||||
|
|
Loading…
Reference in New Issue