summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xmake-boot-image.sh4
-rwxr-xr-xnfs/nfs-autorun.sh4
-rw-r--r--nfs/scripts/funcs.sh15
3 files changed, 19 insertions, 4 deletions
diff --git a/make-boot-image.sh b/make-boot-image.sh
index dd93f38..840cce7 100755
--- a/make-boot-image.sh
+++ b/make-boot-image.sh
@@ -1,6 +1,6 @@
#!/bin/bash -xe
PS4='+ ($LINENO) ' # To ease debugging
-VERSION="1.2-emac-alpha2"
+VERSION="1.2-emac-rc1"
# Config #
##########
@@ -495,7 +495,7 @@ machine_info() {
done
lspci -nn | cut -d' ' -f2- | sed -ne 's/^Ethernet[^:]*/network-card/p'
ip -o l | sed -ne 's/[0-9]*: \([^:]*\):[^\\]*\\\s*link\/ether\s/network-mac-\1: /p'
- lsblk -dnl | sed 's/^/disk: /'
+ lsblk -dnl --output TRAN,PATH,SIZE,RO,TYPE,MODEL,REV | sort | sed 's/^/disk: /'
#lsusb 2>/dev/null | grep -vE hub$ | cut -d: -f2- | sed 's/^ ID/usb-device:/'
setterm -bold off
}
diff --git a/nfs/nfs-autorun.sh b/nfs/nfs-autorun.sh
index bb3c602..04cdf0e 100755
--- a/nfs/nfs-autorun.sh
+++ b/nfs/nfs-autorun.sh
@@ -11,7 +11,9 @@ source $scriptdir/funcs.sh # Load some nfs-autorun.sh specific helper functions
# Check all prerequisites and exit if it fail
hostname_test || exit 1
-firstdisk_test || exit 2
+firstdisk=$(firstdisk)
+firstdisk_test "$firstdisk" || exit 2
+firstdiskp=$(firstdiskp "$firstdisk")
# Run the main action script
if nfswrite_test
diff --git a/nfs/scripts/funcs.sh b/nfs/scripts/funcs.sh
index a1757a1..3d0d849 100644
--- a/nfs/scripts/funcs.sh
+++ b/nfs/scripts/funcs.sh
@@ -33,10 +33,23 @@ nfswrite_test() {
fi
}
+firstdisk() {
+ # "sort", so we have nvme, then sata, then usb
+ lsblk -dnl --output TRAN,PATH | sort | head -n1 | awk '{print $2}'
+}
+
+firstdiskp() {
+ # $1 : disk devnode path as return by firstdisk()
+ echo "$1" | grep -q '[0-9]$' && echo "${1}p" || echo "$1"
+}
+
# no args, print colored message, returns 0 if sda is present and is sata, returns >0 if it is not
firstdisk_test() {
- diskinfo=$(lsblk --list --output TRAN,MODEL --noheadings --nodeps /dev/sda)
+ diskinfo=$(lsblk -dnl --output TRAN,MODEL "$1")
case $diskinfo in
+ nvme*) echo_color green black ">>> First disk is NVMe and is available ($diskinfo)"
+ return 0
+ ;;
sata*) echo_color green black ">>> First disk is SATA and is available ($diskinfo)"
return 0
;;