Merge ~jocave/plainbox-provider-resource:bootloader-core18-fixes into plainbox-provider-resource:master

Proposed by Jonathan Cave
Status: Merged
Approved by: Jonathan Cave
Approved revision: 335d3a915099084e818e845475c5e4a4cf7a5af1
Merged at revision: b3fa18f2730e2be6ed88a923183056d08c3e51c9
Proposed branch: ~jocave/plainbox-provider-resource:bootloader-core18-fixes
Merge into: plainbox-provider-resource:master
Diff against target: 38 lines (+6/-5)
1 file modified
bin/bootloader_resource.py (+6/-5)
Reviewer Review Type Date Requested Status
Sylvain Pineau (community) Approve
Review via email: mp+382319@code.launchpad.net

Description of the change

Checkboex snaps running on core18 based projects need to access the hostfs via the snapd managed path. Use checkbox-support to modify paths when required.

Depends on:
https://code.launchpad.net/~jocave/checkbox-support/+git/checkbox-support/+merge/382317

To post a comment you must log in.
Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/bin/bootloader_resource.py b/bin/bootloader_resource.py
index 5088218..5035deb 100755
--- a/bin/bootloader_resource.py
+++ b/bin/bootloader_resource.py
@@ -17,10 +17,10 @@
1717
18import os18import os
19import re19import re
20import subprocess as sp
2120
22from checkbox_support.parsers.kernel_cmdline import parse_kernel_cmdline21from checkbox_support.parsers.kernel_cmdline import parse_kernel_cmdline
23from checkbox_support.snap_utils.system import get_lk_bootimg_path22from checkbox_support.snap_utils.system import (
23 get_lk_bootimg_path, add_hostfs_prefix)
2424
25# Supported bootloaders and detected files taken from:25# Supported bootloaders and detected files taken from:
26# https://github.com/snapcore/snapd/blob/master/bootloader/bootloader.go26# https://github.com/snapcore/snapd/blob/master/bootloader/bootloader.go
@@ -35,7 +35,8 @@ bootloaders = {
3535
36def detect_bootloader():36def detect_bootloader():
37 for name, config in bootloaders.items():37 for name, config in bootloaders.items():
38 if os.path.exists(os.path.join(config[0], config[1])):38 if os.path.exists(
39 os.path.join(add_hostfs_prefix(config[0]), config[1])):
39 return name40 return name
40 return 'unknown'41 return 'unknown'
4142
@@ -63,8 +64,8 @@ def booted_kernel_location(bl_name):
63 if '(loop)' in grub_path:64 if '(loop)' in grub_path:
64 # implies of out of the kernel snap (so no FDE)65 # implies of out of the kernel snap (so no FDE)
65 pass66 pass
66 elif '(hd1,gpt1)' in grub_path:67 elif re.search(r'\(hd\d,gpt\d\)', grub_path, re.M):
67 # used by fortknox68 # used by fortknox, vasteras,...
68 path = os.path.join(69 path = os.path.join(
69 '/boot/efi', grub_path[grub_path.index(')')+2:])70 '/boot/efi', grub_path[grub_path.index(')')+2:])
70 except ValueError:71 except ValueError:

Subscribers

People subscribed via source and target branches