From 0924b745af44a412a84d9cd9930ac04a910843c9 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 27 Aug 2020 17:02:32 +0200 Subject: [hardware-stats] Move sed so we can properly get the exit code --- .../hardware-stats/data/opt/openslx/scripts/systemd-hardware_stats | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'core/modules/hardware-stats') diff --git a/core/modules/hardware-stats/data/opt/openslx/scripts/systemd-hardware_stats b/core/modules/hardware-stats/data/opt/openslx/scripts/systemd-hardware_stats index 9de35095..65677bb0 100755 --- a/core/modules/hardware-stats/data/opt/openslx/scripts/systemd-hardware_stats +++ b/core/modules/hardware-stats/data/opt/openslx/scripts/systemd-hardware_stats @@ -54,7 +54,7 @@ cleanup() { slxfdisk() { local binary RET for binary in "/opt/openslx/sbin/fdisk -u" "busybox fdisk -u" "fdisk"; do - $binary "$@" | sed -r 's/\s+[0-9]+,[0-9]+,[0-9]+\s+/ /g' # Work around busybox YET AGAIN changing something in an incompatible way + $binary "$@" RET=$? [ "$RET" = "127" ] && continue # command not found [ "$RET" = "1" ] && [ "${binary%% *}" = "busybox" ] && continue # maybe applet not found @@ -174,7 +174,7 @@ if ! slx-tools fs_path_isvolatile "/tmp/virt" ; then fi if [ "$ID44" = 0 ]; then # slxfdisk fallback - for c in $(slxfdisk -l | grep -E '[0-9]+[\-\+]?\s+44\s+' | awk '{print $1}'); do + for c in $(slxfdisk -l | grep -E '[0-9]+[\-\+MG]?\s+44\s+' | awk '{print $1}'); do val=$(blockdev --getsize64 "$c") [ -z "$val" ] && continue [ "$val" -gt "$ID44" ] && ID44=$val @@ -196,7 +196,7 @@ for disk in /dev/disk/by-path/!(*-part*|*-usb-*); do [ -L "$disk" ] || continue disk="$( readlink -f "$disk" )" DISKS+=("$disk") - slxfdisk -l "$disk" + slxfdisk -l "$disk" | sed -r 's/\s+[0-9]+,[0-9]+,[0-9]+\s/ /g' # Work around busybox YET AGAIN changing something in an incompatible way done > "$FDISK" shopt -u extglob [ -z "$SLX_SMARTCTL_MIN_REALLOC" ] && SLX_SMARTCTL_MIN_REALLOC=0 -- cgit v1.2.3-55-g7522