From 8065ed2cd86f347e7d2103751bfffa027b9e5c1a Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 17 Nov 2016 14:48:43 +0100 Subject: [rfs-stage32] Support GPT for ID44 --- .../opt/openslx/scripts/systemd-hardware_stats | 22 ++++++++++++++++------ .../opt/openslx/scripts/systemd-setup_partitions | 3 ++- 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 -- cgit v1.2.3-55-g7522