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
1diff --git a/bin/bootloader_resource.py b/bin/bootloader_resource.py
2index 5088218..5035deb 100755
3--- a/bin/bootloader_resource.py
4+++ b/bin/bootloader_resource.py
5@@ -17,10 +17,10 @@
6
7 import os
8 import re
9-import subprocess as sp
10
11 from checkbox_support.parsers.kernel_cmdline import parse_kernel_cmdline
12-from checkbox_support.snap_utils.system import get_lk_bootimg_path
13+from checkbox_support.snap_utils.system import (
14+ get_lk_bootimg_path, add_hostfs_prefix)
15
16 # Supported bootloaders and detected files taken from:
17 # https://github.com/snapcore/snapd/blob/master/bootloader/bootloader.go
18@@ -35,7 +35,8 @@ bootloaders = {
19
20 def detect_bootloader():
21 for name, config in bootloaders.items():
22- if os.path.exists(os.path.join(config[0], config[1])):
23+ if os.path.exists(
24+ os.path.join(add_hostfs_prefix(config[0]), config[1])):
25 return name
26 return 'unknown'
27
28@@ -63,8 +64,8 @@ def booted_kernel_location(bl_name):
29 if '(loop)' in grub_path:
30 # implies of out of the kernel snap (so no FDE)
31 pass
32- elif '(hd1,gpt1)' in grub_path:
33- # used by fortknox
34+ elif re.search(r'\(hd\d,gpt\d\)', grub_path, re.M):
35+ # used by fortknox, vasteras,...
36 path = os.path.join(
37 '/boot/efi', grub_path[grub_path.index(')')+2:])
38 except ValueError:

Subscribers

People subscribed via source and target branches