check_binfmt_misc: print more helpful error

Instead of letting the mount -t binfmt_misc … command fail, and simply
telling the user that the command failed: rely on the following check
that prints a better error message on error. If it fails at this point,
the kernel option isn't enabled. Add two comments explaining why
check=False is used in this function while at it.

Reviewed-by: Luca Weiss <luca@z3ntu.xyz>
Link: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/%3C20230123064516.1607-1-ollieparanoid@postmarketos.org%3E
This commit is contained in:
Oliver Smith 2023-01-23 07:45:17 +01:00
parent 9975d373b0
commit e8a2ab2e98
No known key found for this signature in database
GPG Key ID: 5AE7F5513E0885CB
1 changed files with 4 additions and 1 deletions

View File

@ -54,9 +54,12 @@ def check_binfmt_misc(args):
if os.path.exists(path):
return
# check=False: this might be built-in instead of being a module
pmb.helpers.run.root(args, ["modprobe", "binfmt_misc"], check=False)
# check=False: we check it below and print a more helpful message on error
pmb.helpers.run.root(args, ["mount", "-t", "binfmt_misc", "none",
"/proc/sys/fs/binfmt_misc"])
"/proc/sys/fs/binfmt_misc"], check=False)
if not os.path.exists(path):
link = "https://postmarketos.org/binfmt_misc"