Add a check for binfmt_misc (#1236)

Closes #1223.
This commit is contained in:
Alexander 2018-02-17 21:41:54 +01:00 committed by Oliver Smith
parent 886d19620e
commit 57b45a4798
2 changed files with 19 additions and 0 deletions

View file

@ -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: