aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2024-02-04 20:50:23 +0100
committerlonkaars <loek@pipeframe.xyz>2024-02-04 20:50:23 +0100
commit2a218ea1205c8dd547b742931290058def5de85f (patch)
tree66a22fb3d9c76566ff7afb843cb3a7a92ad643c9
parent0c5557c257b36e8456ab5c0d8473e9505534c424 (diff)
fix sd card detection for laptop
the sd card is detected as removable and listed as a /dev/sd* device on my desktop pc, but listed as /dev/mmcblk* and non-removable on my laptop. now the state/gen script checks if it is EITHER removable or starts with mmcblk. also fixed `make status` output to look nicer
-rw-r--r--makefile9
-rwxr-xr-xstate/gen5
2 files changed, 7 insertions, 7 deletions
diff --git a/makefile b/makefile
index c75fb11..d6fe483 100644
--- a/makefile
+++ b/makefile
@@ -95,9 +95,8 @@ load_rootfs: state/sdcard_fmt
.PHONY: status
status:
- @echo '### STATUS REPORT'
- @echo '# ENVIRONMENT'
- state/gen
- @echo '# TARGETS'
- @ls state | awk '$$0 == "gen" || $$0 == "auto.mk" { next } { print }'
+ @echo 'ENVIRONMENT'
+ @state/gen | grep ':=' | sed -e 's/^\$$(eval / /' -e 's/)$$//'
+ @echo 'TARGETS'
+ @ls state | awk '$$0 == "gen" { next } { print }' | sed 's/^/ /'
diff --git a/state/gen b/state/gen
index b55096d..e14e337 100755
--- a/state/gen
+++ b/state/gen
@@ -25,11 +25,12 @@ rm -f sdcard_part sdcard_fmt
# if no explicit SDCARD_DISK is set, guess which device is the sd card by
# checking if it is removable AND has a size of approx. 8GB
if [ -z "$SDCARD_DISK" ] ; then
- SDCARD_DISK="$(lsblk --noheadings --bytes --output PATH,SIZE,TYPE,RM | awk '
+ SDCARD_DISK="$(lsblk --noheadings --bytes --list \
+ --output PATH,SIZE,TYPE,RM,NAME | awk '
$3 != "disk" { next }
$2 < 7900000000 { next }
$2 > 8000000000 { next }
- $4 != 1 { next }
+ ($4 != 1) && (match($5, /^mmcblk/) == 0) { next }
{ print $1 }' | head -n1)"
fi
if [ -n "$SDCARD_DISK" ] ; then