Export HOME in pmb.chroot.root() and -.user()
Set HOME to /root for commands started with pmb.chroot.root() and to /home/pmos for commands started with pmb.chroot.user(). POSIX requires this variable to be set, see: <http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap08.html> And this prevents a crash in "adb", which takes and alternative code path if HOME is not set, that does not work with musl (fixes #1638). Thanks to @ryang2678 for figuring this out!
This commit is contained in:
parent
8d461b2ecf
commit
5b33eb7520
|
@ -70,6 +70,7 @@ def root(args, cmd, suffix="native", working_dir="/", output="log",
|
||||||
# Merge env with defaults into env_all
|
# Merge env with defaults into env_all
|
||||||
env_all = {"CHARSET": "UTF-8",
|
env_all = {"CHARSET": "UTF-8",
|
||||||
"HISTFILE": "~/.ash_history",
|
"HISTFILE": "~/.ash_history",
|
||||||
|
"HOME": "/root",
|
||||||
"PATH": pmb.config.chroot_path,
|
"PATH": pmb.config.chroot_path,
|
||||||
"SHELL": "/bin/ash",
|
"SHELL": "/bin/ash",
|
||||||
"TERM": "xterm"}
|
"TERM": "xterm"}
|
||||||
|
|
|
@ -34,6 +34,9 @@ def user(args, cmd, suffix="native", working_dir="/", output="log",
|
||||||
See pmb.helpers.run_core.core() for a detailed description of all other
|
See pmb.helpers.run_core.core() for a detailed description of all other
|
||||||
arguments and the return value.
|
arguments and the return value.
|
||||||
"""
|
"""
|
||||||
|
if "HOME" not in env:
|
||||||
|
env["HOME"] = "/home/pmos"
|
||||||
|
|
||||||
flat_cmd = pmb.helpers.run.flat_cmd(cmd, env=env)
|
flat_cmd = pmb.helpers.run.flat_cmd(cmd, env=env)
|
||||||
cmd = ["busybox", "su", "pmos", "-c", flat_cmd]
|
cmd = ["busybox", "su", "pmos", "-c", flat_cmd]
|
||||||
return pmb.chroot.root(args, cmd, suffix, working_dir, output,
|
return pmb.chroot.root(args, cmd, suffix, working_dir, output,
|
||||||
|
|
Loading…
Reference in New Issue