aboutsummaryrefslogtreecommitdiff
path: root/state/gen
diff options
context:
space:
mode:
Diffstat (limited to 'state/gen')
-rwxr-xr-xstate/gen16
1 files changed, 7 insertions, 9 deletions
diff --git a/state/gen b/state/gen
index da89125..b55096d 100755
--- a/state/gen
+++ b/state/gen
@@ -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