Browse code

Allow packagers to specify a custom dockerinit lookup location via DOCKER_INITPATH in dynbinary

Only necessary if distro policy dictates that the path deviate from the paths already listed in utils/utils.go - please refrain from using it otherwise.

Tianon Gravi authored on 2013/12/05 18:15:47
Showing 2 changed files
... ...
@@ -12,6 +12,6 @@ export DOCKER_INITSHA1="$(sha1sum $DEST/dockerinit-$VERSION | cut -d' ' -f1)"
12 12
 # exported so that "dyntest" can easily access it later without recalculating it
13 13
 
14 14
 (
15
-	export LDFLAGS_STATIC="-X github.com/dotcloud/docker/utils.INITSHA1 \"$DOCKER_INITSHA1\""
15
+	export LDFLAGS_STATIC="-X github.com/dotcloud/docker/utils.INITSHA1 \"$DOCKER_INITSHA1\" -X github.com/dotcloud/docker/utils.INITPATH \"$DOCKER_INITPATH\""
16 16
 	source "$(dirname "$BASH_SOURCE")/binary"
17 17
 )
... ...
@@ -26,6 +26,7 @@ import (
26 26
 var (
27 27
 	IAMSTATIC bool   // whether or not Docker itself was compiled statically via ./hack/make.sh binary
28 28
 	INITSHA1  string // sha1sum of separate static dockerinit, if Docker itself was compiled dynamically via ./hack/make.sh dynbinary
29
+	INITPATH  string // custom location to search for a valid dockerinit binary (available for packagers as a last resort escape hatch)
29 30
 )
30 31
 
31 32
 // A common interface to access the Fatal method of
... ...
@@ -231,6 +232,7 @@ func DockerInitPath(localCopy string) string {
231 231
 	}
232 232
 	var possibleInits = []string{
233 233
 		localCopy,
234
+		INITPATH,
234 235
 		filepath.Join(filepath.Dir(selfPath), "dockerinit"),
235 236
 
236 237
 		// FHS 3.0 Draft: "/usr/libexec includes internal binaries that are not intended to be executed directly by users or shell scripts. Applications may use a single subdirectory under /usr/libexec."