diff options
-rw-r--r-- | makefile | 10 | ||||
-rwxr-xr-x | state/gen | 16 |
2 files changed, 12 insertions, 14 deletions
@@ -24,8 +24,7 @@ export # create dummy files to represent non-file targets (container image build # status, sd card partition status, git submodule initialization, etc.) -$(shell state/gen) --include state/auto.mk +$(eval $(shell state/gen)) # read environment variables from ./env include ./env @@ -51,6 +50,7 @@ state/sdcard_part: touch $@ state/sdcard_fmt: state/sdcard_part + $(eval $(shell state/gen)) $(AS_ROOT) mkfs.vfat -n BOOT -F 32 $(SDCARD_PART_BOOT) $(AS_ROOT) mkfs.ext4 -L ROOTFS -F $(SDCARD_PART_ROOTFS) touch $@ @@ -91,8 +91,8 @@ load_rootfs: .PHONY: status status: @echo '### STATUS REPORT' - @echo '# DETECTED SD CARD' - @cat state/auto.mk - @echo '# DETECTED STATE' + @echo '# ENVIRONMENT' + state/gen + @echo '# TARGETS' @ls state | awk '$$0 == "gen" || $$0 == "auto.mk" { next } { print }' @@ -1,10 +1,6 @@ #!/bin/sh -# redirect stdout to stderr (stdout gets interpreted by make) -exec 1>&2 # create files in the same directory as this script cd "$(dirname "$0")" -# do not run anything if make was run with -n (dry run) -[ "${MAKEFLAGS#*n}" != "$MAKEFLAGS" ] && exit # container image (initialized here, updated in makefile) $CTR image exists "$CTR_IMG_TAG" 1> /dev/null 2> /dev/null @@ -41,7 +37,8 @@ if [ -n "$SDCARD_DISK" ] ; then # variables are set if [ -z "$SDCARD_PART_BOOT" ] || [ -z "$SDCARD_PART_ROOTFS" ] ; then PARTS="$(lsblk "$SDCARD_DISK" --bytes --noheadings \ - --output PATH,SIZE,TYPE,PTTYPE,FSTYPE,LABEL,PARTFLAGS)" + --output PATH,SIZE,TYPE,PTTYPE,FSTYPE,LABEL,PARTFLAGS \ + 2> /dev/null)" # check if the disk is partitioned correctly echo "$PARTS" | awk ' @@ -69,9 +66,10 @@ if [ -n "$SDCARD_DISK" ] ; then fi fi -cat << EOF > auto.mk -SDCARD_DISK ?= $SDCARD_DISK -SDCARD_PART_BOOT ?= $SDCARD_PART_BOOT -SDCARD_PART_ROOTFS ?= $SDCARD_PART_ROOTFS +cat << EOF +\$(eval SDCARD_DISK := $SDCARD_DISK) +\$(eval SDCARD_PART_BOOT := $SDCARD_PART_BOOT) +\$(eval SDCARD_PART_ROOTFS := $SDCARD_PART_ROOTFS) +\$(eval export) EOF |