mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-07-15 01:24:29 +02:00
add efi partition split
This commit is contained in:
@ -1,7 +1,8 @@
|
|||||||
jc changelog
|
jc changelog
|
||||||
|
|
||||||
20221117 v1.22.3
|
20221118 v1.22.3
|
||||||
- Fix `git-log` and `git-log-s` parsers for failure on empty author name
|
- Fix `git-log` and `git-log-s` parsers for failure on empty author name
|
||||||
|
- Update `os-prober` parser with split EFI partition fields
|
||||||
- Fix several documentation typos
|
- Fix several documentation typos
|
||||||
|
|
||||||
20221107 v1.22.2
|
20221107 v1.22.2
|
||||||
|
@ -21,12 +21,15 @@ Usage (module):
|
|||||||
Schema:
|
Schema:
|
||||||
|
|
||||||
{
|
{
|
||||||
'partition': string,
|
"partition": string,
|
||||||
'name': string,
|
"efi_bootmgr": string, # [0]
|
||||||
'short_name': string,
|
"name": string,
|
||||||
'type': string
|
"short_name": string,
|
||||||
|
"type": string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[0] only exists if an EFI boot manager is detected
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
$ os-prober | jc --os-prober -p
|
$ os-prober | jc --os-prober -p
|
||||||
@ -60,4 +63,4 @@ Returns:
|
|||||||
### Parser Information
|
### Parser Information
|
||||||
Compatibility: linux
|
Compatibility: linux
|
||||||
|
|
||||||
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -16,12 +16,15 @@ Usage (module):
|
|||||||
Schema:
|
Schema:
|
||||||
|
|
||||||
{
|
{
|
||||||
'partition': string,
|
"partition": string,
|
||||||
'name': string,
|
"efi_bootmgr": string, # [0]
|
||||||
'short_name': string,
|
"name": string,
|
||||||
'type': string
|
"short_name": string,
|
||||||
|
"type": string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[0] only exists if an EFI boot manager is detected
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
$ os-prober | jc --os-prober -p
|
$ os-prober | jc --os-prober -p
|
||||||
@ -39,7 +42,7 @@ import jc.utils
|
|||||||
|
|
||||||
class info():
|
class info():
|
||||||
"""Provides parser metadata (version, author, etc.)"""
|
"""Provides parser metadata (version, author, etc.)"""
|
||||||
version = '1.0'
|
version = '1.1'
|
||||||
description = '`os-prober` command parser'
|
description = '`os-prober` command parser'
|
||||||
author = 'Kelly Brazil'
|
author = 'Kelly Brazil'
|
||||||
author_email = 'kellyjonbrazil@gmail.com'
|
author_email = 'kellyjonbrazil@gmail.com'
|
||||||
@ -62,6 +65,12 @@ def _process(proc_data: JSONDictType) -> JSONDictType:
|
|||||||
|
|
||||||
Dictionary. Structured to conform to the schema.
|
Dictionary. Structured to conform to the schema.
|
||||||
"""
|
"""
|
||||||
|
# check for EFI partition@boot-manager and split/add fields
|
||||||
|
if 'partition' in proc_data and '@' in proc_data['partition']: # type: ignore
|
||||||
|
new_part, efi_bootmgr = proc_data['partition'].split('@') # type: ignore
|
||||||
|
proc_data['partition'] = new_part
|
||||||
|
proc_data['efi_bootmgr'] = efi_bootmgr
|
||||||
|
|
||||||
return proc_data
|
return proc_data
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,8 +19,8 @@ class MyTests(unittest.TestCase):
|
|||||||
"""
|
"""
|
||||||
Test 'os_prober' 1
|
Test 'os_prober' 1
|
||||||
"""
|
"""
|
||||||
self.assertEqual(parse(
|
self.assertEqual(
|
||||||
'/dev/sda1:Windows 7 (loader):Windows:chain', quiet=True),
|
parse('/dev/sda1:Windows 7 (loader):Windows:chain', quiet=True),
|
||||||
{"partition":"/dev/sda1","name":"Windows 7 (loader)","short_name":"Windows","type":"chain"}
|
{"partition":"/dev/sda1","name":"Windows 7 (loader)","short_name":"Windows","type":"chain"}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -28,8 +28,8 @@ class MyTests(unittest.TestCase):
|
|||||||
"""
|
"""
|
||||||
Test 'os_prober' 2
|
Test 'os_prober' 2
|
||||||
"""
|
"""
|
||||||
self.assertEqual(parse(
|
self.assertEqual(
|
||||||
'/dev/sda1:Windows 10:Windows:chain', quiet=True),
|
parse('/dev/sda1:Windows 10:Windows:chain', quiet=True),
|
||||||
{"partition":"/dev/sda1","name":"Windows 10","short_name":"Windows","type":"chain"}
|
{"partition":"/dev/sda1","name":"Windows 10","short_name":"Windows","type":"chain"}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -37,8 +37,17 @@ class MyTests(unittest.TestCase):
|
|||||||
"""
|
"""
|
||||||
Test 'os_prober' 3
|
Test 'os_prober' 3
|
||||||
"""
|
"""
|
||||||
self.assertEqual(parse(
|
self.assertEqual(
|
||||||
'/dev/sda1@/efi/Microsoft/Boot/bootmgfw.efi:Windows Boot Manager:Windows:efi', quiet=True),
|
parse('/dev/sda1@/efi/Microsoft/Boot/bootmgfw.efi:Windows Boot Manager:Windows:efi', quiet=True),
|
||||||
|
{"partition":"/dev/sda1","efi_bootmgr":"/efi/Microsoft/Boot/bootmgfw.efi","name":"Windows Boot Manager","short_name":"Windows","type":"efi"}
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_os_prober_3_raw(self):
|
||||||
|
"""
|
||||||
|
Test 'os_prober' 3 with raw output
|
||||||
|
"""
|
||||||
|
self.assertEqual(
|
||||||
|
parse('/dev/sda1@/efi/Microsoft/Boot/bootmgfw.efi:Windows Boot Manager:Windows:efi', quiet=True, raw=True),
|
||||||
{"partition":"/dev/sda1@/efi/Microsoft/Boot/bootmgfw.efi","name":"Windows Boot Manager","short_name":"Windows","type":"efi"}
|
{"partition":"/dev/sda1@/efi/Microsoft/Boot/bootmgfw.efi","name":"Windows Boot Manager","short_name":"Windows","type":"efi"}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user