Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to disable features with command line argument #100

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion build
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ container_run_opts=(
)

container_cmd=()
features_disabled=()

use_kms=0
resolve_cname=0
Expand All @@ -37,6 +38,10 @@ while [ $# -gt 0 ]; do
declare -a "container_run_opts=($2)"
shift 2
;;
--disable-feature)
features_disabled+=("$2")
shift 2
;;
--privileged)
container_run_opts+=(--privileged)
container_cmd=(--second-stage)
Expand Down Expand Up @@ -87,7 +92,6 @@ commit="$(./get_commit)"
timestamp="$(./get_timestamp)"
default_version="$(./get_version)"


if [ "$resolve_cname" = 1 ]; then
arch="$("$container_engine" run --rm "${container_run_opts[@]}" "${container_mount_opts[@]}" "$container_image" dpkg --print-architecture)"
cname="$("$container_engine" run --rm "${container_run_opts[@]}" "${container_mount_opts[@]}" "$container_image" /builder/parse_features --feature-dir /builder/features --default-arch "$arch" --default-version "$default_version" --cname "$1")"
Expand All @@ -101,6 +105,7 @@ make_opts=(
COMMIT="$commit"
TIMESTAMP="$timestamp"
DEFAULT_VERSION="$default_version"
FEATURES_DISABLED="$(IFS="," ; echo "${features_disabled[*]}")"
)

if [ "$use_kms" = 1 ]; then
Expand Down
3 changes: 2 additions & 1 deletion builder/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ endef
required_vars := REPO COMMIT TIMESTAMP DEFAULT_VERSION TEMPFS_SIZE
$(foreach var,$(required_vars),$(eval $(call require_var,$(var))))

FEATURES_DISABLED ?= ''
SHORT_COMMIT := $(shell head -c 8 <<< '$(COMMIT)')

NATIVE_ARCH := $(shell dpkg --print-architecture)
Expand Down Expand Up @@ -54,7 +55,7 @@ clean:
.build/%-$(SHORT_COMMIT).tar: .build/bootstrap-$$(call cname_arch,$$*)-$$(call cname_version,$$*)-$(SHORT_COMMIT).tar .build/native_bin-$$(call cname_version,$$*)-$(SHORT_COMMIT).tar $(shell ./make_directory_sentinel features) $(shell ./make_directory_sentinel cert)
target '$@' '$<'
info 'configuring rootfs $*-$(SHORT_COMMIT)'
features="$$(./parse_features --feature-dir features --cname '$*' features)"
features="$$(./parse_features --feature-dir features --ignore '$(FEATURES_DISABLED)' --cname '$*' features)"
BUILDER_CNAME='$*'
BUILDER_VERSION='$(call cname_version,$*)'
BUILDER_ARCH='$(call cname_arch,$*)'
Expand Down
Loading