Skip to content

Commit 03de844

Browse files
committed
Add support to disable features with command line argument
The newly added command line argument `--disable-feature` supports removing feature dependencies normally added to an image. Closes: #17 Signed-off-by: Tobias Wolf <[email protected]>
1 parent b399457 commit 03de844

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

build

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ container_run_opts=(
1919
)
2020

2121
container_cmd=()
22+
features_disabled=()
2223

2324
use_kms=0
2425
resolve_cname=0
@@ -37,6 +38,10 @@ while [ $# -gt 0 ]; do
3738
declare -a "container_run_opts=($2)"
3839
shift 2
3940
;;
41+
--disable-feature)
42+
features_disabled+=("$2")
43+
shift 2
44+
;;
4045
--privileged)
4146
container_run_opts+=(--privileged)
4247
container_cmd=(--second-stage)
@@ -87,7 +92,6 @@ commit="$(./get_commit)"
8792
timestamp="$(./get_timestamp)"
8893
default_version="$(./get_version)"
8994

90-
9195
if [ "$resolve_cname" = 1 ]; then
9296
arch="$("$container_engine" run --rm "${container_run_opts[@]}" "${container_mount_opts[@]}" "$container_image" dpkg --print-architecture)"
9397
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")"
@@ -101,6 +105,7 @@ make_opts=(
101105
COMMIT="$commit"
102106
TIMESTAMP="$timestamp"
103107
DEFAULT_VERSION="$default_version"
108+
FEATURES_DISABLED=$(IFS="," ; echo "${features_disabled[*]}")
104109
)
105110

106111
if [ "$use_kms" = 1 ]; then

builder/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ endef
2424
required_vars := REPO COMMIT TIMESTAMP DEFAULT_VERSION TEMPFS_SIZE
2525
$(foreach var,$(required_vars),$(eval $(call require_var,$(var))))
2626

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

2930
NATIVE_ARCH := $(shell dpkg --print-architecture)
@@ -54,7 +55,7 @@ clean:
5455
.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)
5556
target '$@' '$<'
5657
info 'configuring rootfs $*-$(SHORT_COMMIT)'
57-
features="$$(./parse_features --feature-dir features --cname '$*' features)"
58+
features="$$(./parse_features --feature-dir features --ignore '$(FEATURES_DISABLED)' --cname '$*' features)"
5859
BUILDER_CNAME='$*'
5960
BUILDER_VERSION='$(call cname_version,$*)'
6061
BUILDER_ARCH='$(call cname_arch,$*)'

0 commit comments

Comments
 (0)