Skip to content

Commit 84a612e

Browse files
committed
Updated cmdline to fall back on builtin mount if it fails
Signed-off-by: Zen <[email protected]>
1 parent 688366d commit 84a612e

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/ugrd/base/cmdline.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
__author__ = 'desultory'
2-
__version__ = '0.1.0'
2+
__version__ = '0.2.0'
33

44

55
def parse_cmdline(self) -> str:
@@ -12,4 +12,8 @@ def mount_cmdline_root(self) -> str:
1212
""" Returns bash script to mount root partition based on /proc/cmdline """
1313
mount_dest = self['mounts']['root']['destination'] if not self.get('switch_root_target') else self['switch_root_target']
1414
return ["echo 'Mounting root partition based on /proc/cmdline'",
15-
f"mount $CMDLINE_ROOT {mount_dest} -o ro"]
15+
f"mount $CMDLINE_ROOT {mount_dest} -o ro",
16+
'if [ $? -ne 0 ]; then',
17+
' echo "Failed to mount the root parition using /proc/cmdline"',
18+
' mount_root',
19+
'fi']

src/ugrd/base/cmdline.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,7 @@ mod_depends = ['ugrd.base.base']
88

99
[masks]
1010
init_mount = [ "mount_root" ]
11+
12+
# Import this function to be used by mount_cmdline_root
13+
[imports.functions]
14+
"ugrd.fs.mounts" = [ "mount_root" ]

0 commit comments

Comments
 (0)