-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
*: add bottlecap, an optional entry point
Add bottlecap as the default entry point. It will handle launching the coreos-assembler container and optionally binding in and rebuilding certain aspects to aid development. This is in additon to the existing flows.
- Loading branch information
Andrew Jeddeloh
committed
Oct 25, 2018
1 parent
9df4d65
commit 30aa151
Showing
3 changed files
with
88 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/Cargo.lock | ||
/target | ||
**/*.rs.bk | ||
src/__pycache__ |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
#!/bin/sh | ||
|
||
# bottlecap, 'cause it's kinda like cork... get it? | ||
|
||
usage() { | ||
echo "usage:" | ||
echo "bottlecap [--dev] [--runtime $runtime] [--build-dir $build_dir] [--container $container] assemblerargs..." | ||
echo " --dev: rebuild and reinstall mantle, the build scripts, and the ostree-releng-scipts before running coreos-assembler" | ||
echo " --runtime: (auto) specify whether to use podman or docker. Defaults to podman if it is in \$PATH" | ||
echo " --build-dir: Where to put build artifacts, defaults to the current directory" | ||
echo " --container: which coreos-assembler container to use" | ||
echo " --help: print this help message" | ||
echo "Command to be executed:" | ||
runtime="echo $runtime" | ||
} | ||
|
||
dev=0 | ||
help=0 | ||
runtime="podman" | ||
which podman &> /dev/null || runtime="docker" | ||
build_dir="$(pwd)" | ||
container="quay.io/cgwalters/coreos-assembler" | ||
|
||
TEMP=$(getopt -o 'dr:b:c:h' --long 'dev,runtime:,build-dir:,container:,help' -- $@) | ||
eval set -- "$TEMP" | ||
|
||
while : | ||
do | ||
case "$1" in | ||
"-d"|"--dev") | ||
dev=1 | ||
shift | ||
;; | ||
"-r"|"--runtime") | ||
shift | ||
runtime="$1" | ||
shift | ||
;; | ||
"-b"|"--build-dir") | ||
shift | ||
build_dir="$(readlink -f $1)" | ||
shift | ||
;; | ||
"-c"|"--container") | ||
shift | ||
container="$1" | ||
shift | ||
;; | ||
"-h"|"--help") | ||
help=1 | ||
shift | ||
;; | ||
--) | ||
shift | ||
break | ||
;; | ||
*) | ||
echo "Error parsing args" | ||
exit 1 | ||
;; | ||
esac | ||
done | ||
|
||
if [ "$help" == 1 ]; then | ||
usage | ||
fi | ||
|
||
script_dir="$(dirname $(readlink -f $0))" | ||
|
||
volumes="-v $build_dir:/srv " | ||
|
||
entrypoint="" | ||
|
||
if [ "$dev" == 1 ]; then | ||
volumes+="-v $script_dir:/host/src " | ||
volumes+="-v $(go env GOCACHE):/root/.cache/go-build " | ||
entrypoint="--entrypoint /host/src/bottlecap-shim" | ||
fi | ||
|
||
$runtime run --rm --net=host -ti --privileged --userns=host $volumes --workdir /srv $entrypoint $container $@ |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
|
||
pushd /host/src/ | ||
sudo ./build.sh make_and_makeinstall | ||
popd | ||
|
||
exec /usr/bin/coreos-assembler $@ |