This repository was archived by the owner on Feb 24, 2020. It is now read-only.
Repository navigation
Default stage1 path should be configurable with a build option - #520
Merged
Merged
Conversation
Contributor
|
You're totally right, I realised this late last night after I had told you it was possible! I'm proposing using an environment variable at build time to specify this. |
Contributor
Author
There was a problem hiding this comment.
there is probably a better way of doing this than using eval but my bash fu is terrible, so improvements gladly welcomed.
Contributor
There was a problem hiding this comment.
What am I missing here, just drop the eval?
Contributor
Author
There was a problem hiding this comment.
+ go build -o /home/jon/git/rocket/bin/rkt -ldflags ''\''-X' main.defaultStage1Image '/foo'\''' github.com/coreos/rocket/rkt
invalid value "'-X" for flag -ldflags: unterminated ' string
Contributor
There was a problem hiding this comment.
You are escaping ' but not inside of another string. You probably want:
${RKT_STAGE1_IMAGE:+-ldflags "-X main.defaultStage1Image '${RKT_STAGE1_IMAGE}'"} \
And drop the eval. It is only going to make escaping more complicated.
Alternatively it may be clearer to construct arguments in an array:
args=( build -o "${GOBIN}/rkt" )
if [[ -n "${RKT_STAGE1_IMAGE}" ]]; then
args+=( -ldflags "-X main.defaultStage1Image '${RKT_STAGE1_IMAGE}'" )
fi
go "${args[@]}" "${REPO_PATH}/rkt"or something like that.
This introduces the ability to set the default stage1 image path for `rkt run` by setting the environment variable RKT_STAGE1_IMAGE at build time (i.e when invoking ./build). The variable should be set to the fully qualified path at which rkt can find the stage1 image - for example: RKT_STAGE1_IMAGE=/usr/lib/rkt/stage1.aci ./build Rocket will use this environment variable to set the default value for the stage1-image flag. If the value is _not_ set, it will continue to use the heuristic it does today to guess the location of the stage1 image, by looking for a file called stage1.aci that is in the same directory as rkt itself.
Contributor
|
lgtm |
jonboulle
added a commit
that referenced
this pull request
Feb 13, 2015
Default stage1 path should be configurable with a build option
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As mentioned in #457 (comment), the path where the rkt binary looks for stage1 should be something you can specify when building rocket.
Looking at the code, this doesn't currently appear to be the case.
This is currently blocking a fix to the Arch Linux AUR package, and will probably be necessary for other distributions as well.