Skip to content
Snippets Groups Projects
Commit 57b45a47 authored by Alexander's avatar Alexander Committed by Oliver Smith
Browse files

Add a check for binfmt_misc (#1236)

Closes #1223.
parent 886d1962
Branches
Tags
No related merge requests found
......@@ -20,6 +20,7 @@ import os
import logging
import pmb.helpers.run
import pmb.helpers.other
import pmb.parse
import pmb.parse.arch
......@@ -35,6 +36,7 @@ def register(args, arch):
arch_debian = pmb.parse.arch.alpine_to_debian(arch)
if is_registered(arch_debian):
return
pmb.helpers.other.check_binfmt_misc(args)
pmb.chroot.apk.install(args, ["qemu-user-static-repack",
"qemu-user-static-repack-binfmt"])
info = pmb.parse.binfmt_info(args, arch_debian)
......
......@@ -61,6 +61,23 @@ def check_grsec(args):
" more details: <" + link + ">")
def check_binfmt_misc(args):
"""
Check if the 'binfmt_misc' module is loaded by checking, if
/proc/sys/fs/binfmt_misc/ exists. If it exists, then do nothing.
Otherwise, raise an exception pointing to user to the Wiki.
"""
path = "/proc/sys/fs/binfmt_misc/"
if os.path.exists(path):
return
link = "https://postmarketos.org/binfmt_misc"
raise RuntimeError("It appears that your system has not loaded the"
" module 'binfmt_misc'. This is required to run"
" foreign architecture programs with QEMU (eg."
" armhf on x86_64):\n See: <" + link + ">")
def migrate_success(args):
logging.info("Migration done")
with open(args.work + "/version", "w") as handle:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment