binfmt.py: use exec.run_root_cmd()
This commit is contained in:
parent
fdf03e2b97
commit
b32099c4f1
1 changed files with 3 additions and 3 deletions
|
@ -2,8 +2,8 @@
|
|||
|
||||
import os
|
||||
import logging
|
||||
import subprocess
|
||||
|
||||
from exec import run_root_cmd
|
||||
from utils import mount
|
||||
|
||||
|
||||
|
@ -63,7 +63,7 @@ def register(arch):
|
|||
|
||||
# Register in binfmt_misc
|
||||
logging.info(f"Registering qemu binfmt ({arch})")
|
||||
subprocess.run(["sh", "-c", 'echo "' + code + '" > ' + register + ' 2>/dev/null'])
|
||||
run_root_cmd(["sh", "-c", f'echo "{code}" > {register} 2>/dev/null'])
|
||||
if not is_registered(arch):
|
||||
logging.debug(f'binfmt line: {code}')
|
||||
raise Exception(f'Failed to register qemu-user for {arch} with binfmt_misc, {binfmt}/{info["name"]} not found')
|
||||
|
@ -74,4 +74,4 @@ def unregister(arch):
|
|||
if not os.path.exists(binfmt_file):
|
||||
return
|
||||
logging.info(f"Unregistering qemu binfmt ({arch})")
|
||||
subprocess.run(["sh", "-c", "echo -1 > " + binfmt_file])
|
||||
run_root_cmd(["sh", "-c", f"echo -1 > {binfmt_file}"])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue