Use entrypoint directly as AppRun
This removes the intermediate bash script which was running, which _potentially_ fixes #2. Since that bash script is no longer setting PATH, the daemon must manually create the binary path for each sub-process anyway.
This commit is contained in:
parent
57f63750f3
commit
a1b3ff71b3
@ -1,4 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
export PATH=$APPDIR/bin
|
|
||||||
exec entrypoint "$@"
|
|
33
default.nix
33
default.nix
@ -91,19 +91,32 @@ in rec {
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
appDir = pkgs.buildEnv {
|
appDir = pkgs.stdenv.mkDerivation {
|
||||||
name = "cryptic-net-AppDir";
|
name = "cryptic-net-AppDir";
|
||||||
paths = [
|
|
||||||
|
|
||||||
./AppDir
|
src = pkgs.buildEnv {
|
||||||
version
|
name = "cryptic-net-AppDir-base";
|
||||||
dnsmasq
|
paths = [
|
||||||
nebula
|
|
||||||
garage
|
|
||||||
pkgs.minio-client
|
|
||||||
entrypoint
|
|
||||||
|
|
||||||
] ++ (if bootstrap != null then [ rootedBootstrap ] else []);
|
./AppDir
|
||||||
|
version
|
||||||
|
dnsmasq
|
||||||
|
nebula
|
||||||
|
garage
|
||||||
|
pkgs.minio-client
|
||||||
|
entrypoint
|
||||||
|
|
||||||
|
] ++ (if bootstrap != null then [ rootedBootstrap ] else []);
|
||||||
|
};
|
||||||
|
|
||||||
|
builder = builtins.toFile "build.sh" ''
|
||||||
|
source $stdenv/setup
|
||||||
|
cp -rL "$src" "$out"
|
||||||
|
chmod +w "$out" -R
|
||||||
|
|
||||||
|
cd "$out"
|
||||||
|
cp ./bin/entrypoint ./AppRun
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
appimagetool = pkgs.callPackage ./nix/appimagetool.nix {};
|
appimagetool = pkgs.callPackage ./nix/appimagetool.nix {};
|
||||||
|
@ -45,7 +45,7 @@ func dnsmasqPmuxProcConfig(
|
|||||||
|
|
||||||
return pmuxlib.ProcessConfig{
|
return pmuxlib.ProcessConfig{
|
||||||
Name: "dnsmasq",
|
Name: "dnsmasq",
|
||||||
Cmd: "dnsmasq",
|
Cmd: binPath("dnsmasq"),
|
||||||
Args: []string{"-d", "-C", confPath},
|
Args: []string{"-d", "-C", confPath},
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ var subCmdGarageMC = subCmd{
|
|||||||
args = args[i:]
|
args = args[i:]
|
||||||
}
|
}
|
||||||
|
|
||||||
args = append([]string{"mc"}, args...)
|
args = append([]string{binPath("mc")}, args...)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
mcHostVar = fmt.Sprintf(
|
mcHostVar = fmt.Sprintf(
|
||||||
@ -92,7 +92,7 @@ var subCmdGarageCLI = subCmd{
|
|||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
binPath = filepath.Join(envAppDirPath, "bin/garage")
|
binPath = binPath("garage")
|
||||||
args = append([]string{"garage"}, subCmdCtx.args...)
|
args = append([]string{"garage"}, subCmdCtx.args...)
|
||||||
cliEnv = append(
|
cliEnv = append(
|
||||||
os.Environ(),
|
os.Environ(),
|
||||||
|
@ -168,7 +168,7 @@ func garagePmuxProcConfigs(
|
|||||||
|
|
||||||
pmuxProcConfigs = append(pmuxProcConfigs, pmuxlib.ProcessConfig{
|
pmuxProcConfigs = append(pmuxProcConfigs, pmuxlib.ProcessConfig{
|
||||||
Name: fmt.Sprintf("garage-%d", alloc.RPCPort),
|
Name: fmt.Sprintf("garage-%d", alloc.RPCPort),
|
||||||
Cmd: "garage",
|
Cmd: binPath("garage"),
|
||||||
Args: []string{"-c", childConfigPath, "server"},
|
Args: []string{"-c", childConfigPath, "server"},
|
||||||
StartAfterFunc: func(ctx context.Context) error {
|
StartAfterFunc: func(ctx context.Context) error {
|
||||||
return waitForNebula(ctx, hostBootstrap)
|
return waitForNebula(ctx, hostBootstrap)
|
||||||
|
@ -31,6 +31,10 @@ var (
|
|||||||
envDataDirPath = filepath.Join(xdg.DataHome, "cryptic-net")
|
envDataDirPath = filepath.Join(xdg.DataHome, "cryptic-net")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func binPath(name string) string {
|
||||||
|
return filepath.Join(envAppDirPath, "bin", name)
|
||||||
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
logger := mlog.NewLogger(&mlog.LoggerOpts{
|
logger := mlog.NewLogger(&mlog.LoggerOpts{
|
||||||
|
@ -111,7 +111,7 @@ func nebulaPmuxProcConfig(
|
|||||||
|
|
||||||
return pmuxlib.ProcessConfig{
|
return pmuxlib.ProcessConfig{
|
||||||
Name: "nebula",
|
Name: "nebula",
|
||||||
Cmd: "nebula",
|
Cmd: binPath("nebula"),
|
||||||
Args: []string{"-config", nebulaYmlPath},
|
Args: []string{"-config", nebulaYmlPath},
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user