summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2016-11-17 14:48:43 +0100
committerSimon Rettberg2016-11-17 14:48:43 +0100
commit8065ed2cd86f347e7d2103751bfffa027b9e5c1a (patch)
tree913c6b99e17fe69edb64750782b7fb5ef87f1485
parent[kernel-vanilla] 4.8.8 (diff)
downloadtm-scripts-8065ed2cd86f347e7d2103751bfffa027b9e5c1a.tar.gz
tm-scripts-8065ed2cd86f347e7d2103751bfffa027b9e5c1a.tar.xz
tm-scripts-8065ed2cd86f347e7d2103751bfffa027b9e5c1a.zip
[rfs-stage32] Support GPT for ID44
-rwxr-xr-xremote/modules/hardware-stats/data/opt/openslx/scripts/systemd-hardware_stats22
-rwxr-xr-xremote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_partitions3
2 files changed, 18 insertions, 7 deletions
diff --git a/remote/modules/hardware-stats/data/opt/openslx/scripts/systemd-hardware_stats b/remote/modules/hardware-stats/data/opt/openslx/scripts/systemd-hardware_stats
index 6f4e25ec..4dd53d7b 100755
--- a/remote/modules/hardware-stats/data/opt/openslx/scripts/systemd-hardware_stats
+++ b/remote/modules/hardware-stats/data/opt/openslx/scripts/systemd-hardware_stats
@@ -107,12 +107,22 @@ fi
# 8) ID44 partition size
ID44=0
-for c in $(fdisk -l | grep -E '[0-9]+[\-\+]?\s+44\s+' | awk '{print $1}'); do
- val=$(blockdev --getsize64 "$c")
- [ -z "$val" ] && continue
- [ "$val" -gt "$ID44" ] && ID44=$val
-done
-ID44=$(( $ID44 / 1058576 )) # we'd rather underreport
+# Try df first, make sure device starts with /dev
+read -r df_dev df_size df_used df_avail df_usepercent df_mountpoint df_crap < <(df /tmp | grep ' /tmp$')
+if [ -n "${df_size}" ] && [ "${df_dev:0:5}" = "/dev/" ]; then
+ # df reports kbytes, convert to MB
+ ID44=$(( df_size / 1024 ))
+fi
+if [ "$ID44" = 0 ]; then
+ # fdisk fallback
+ for c in $(fdisk -l | grep -E '[0-9]+[\-\+]?\s+44\s+' | awk '{print $1}'); do
+ val=$(blockdev --getsize64 "$c")
+ [ -z "$val" ] && continue
+ [ "$val" -gt "$ID44" ] && ID44=$val
+ done
+ # blockdev reports bytes, convert to MB
+ ID44=$(( $ID44 / 1058576 )) # we'd rather underreport
+fi
# 9) check smart values
FDISK=$(mktemp)
diff --git a/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_partitions b/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_partitions
index 4dc84828..c3813af9 100755
--- a/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_partitions
+++ b/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_partitions
@@ -127,7 +127,8 @@ done
# space, thus no normal filesystem will be incidentally deleted or
# corrupted
HAVE_TEMP=no
-for PART_DEV in $(get_all_with_id 44); do
+for PART_DEV in $(get_all_with_id 44) "/dev/disk/by-partlabel/OpenSLX-ID44"; do
+ [ -e "$PART_DEV" ] || continue # Since OpenSLX-ID44 is hard-coded and might not exist
# check for supported filesystem and formatter
if format_disk "$PART_DEV"; then
# echo "$PART_DEV is mounted to /mnt/tmp at $(sysup)" >/tmp/tmpready