aboutsummaryrefslogtreecommitdiff
path: root/state
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2024-02-04 11:36:57 +0100
committerlonkaars <loek@pipeframe.xyz>2024-02-04 11:36:57 +0100
commit8b13b14dfcd668c13df68d69c4d3b28027cd022e (patch)
tree9a96ee1e09d704aaedc2b10278b172eaa6465cab /state
parent4f8507ff8756cac446a01d7d3a28bdf4f963adf5 (diff)
update build environment after repartitioning sd card
Diffstat (limited to 'state')
-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