set HOME=/perm/$basename when starting services
Previously, HOME was inherited from the environment of the init process, which has HOME=/ set. Of course, / is not writable on gokrazy, so this change makes things less strict and should therefore not break any deployments.
This commit is contained in:
parent
9e57e3cf2e
commit
32f88999da
@ -273,6 +273,7 @@ func supervise(s *service) {
|
|||||||
cmd := &exec.Cmd{
|
cmd := &exec.Cmd{
|
||||||
Path: s.cmd.Path,
|
Path: s.cmd.Path,
|
||||||
Args: s.cmd.Args,
|
Args: s.cmd.Args,
|
||||||
|
Env: os.Environ(),
|
||||||
Stdout: s.Stdout,
|
Stdout: s.Stdout,
|
||||||
Stderr: s.Stderr,
|
Stderr: s.Stderr,
|
||||||
SysProcAttr: &syscall.SysProcAttr{
|
SysProcAttr: &syscall.SysProcAttr{
|
||||||
@ -282,6 +283,12 @@ func supervise(s *service) {
|
|||||||
if attempt == 0 {
|
if attempt == 0 {
|
||||||
cmd.Env = append(cmd.Env, "GOKRAZY_FIRST_START=1")
|
cmd.Env = append(cmd.Env, "GOKRAZY_FIRST_START=1")
|
||||||
}
|
}
|
||||||
|
// Designate a subdirectory under /perm as $HOME.
|
||||||
|
// This mirrors what gokrazy system daemons and
|
||||||
|
// ported daemons would do, so setting $HOME
|
||||||
|
// increases the chance that third-party daemons
|
||||||
|
// just work.
|
||||||
|
cmd.Env = append(cmd.Env, "HOME=/perm/"+filepath.Base(s.cmd.Path))
|
||||||
|
|
||||||
attempt++
|
attempt++
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user