From: Michael Prokop Date: Mon, 14 Feb 2022 16:37:16 +0000 (+0100) Subject: Iterate over present disks to collect "sfdisk -d" information X-Git-Tag: v0.16.1~1 X-Git-Url: http://git.grml.org/?p=grml-hwinfo.git;a=commitdiff_plain;h=e98e5ca4bf23daac1298f2520fd386c737b6997c Iterate over present disks to collect "sfdisk -d" information AFAICT, up and until Debian/jessie the sfdisk executable could be invoked without the need to specify any specific device name on the command line. In "newer" versions of sfdisk this is no longer supported, so we need to iterate over the list of present disk devices. With this change, the sfdisk_... files can also be used standalone, which is useful e.g. for restoring a partition table. Development time sponsored by Sipwise GmbH --- diff --git a/grml-hwinfo b/grml-hwinfo index 4e1d9d5..c8d299f 100755 --- a/grml-hwinfo +++ b/grml-hwinfo @@ -329,7 +329,7 @@ cd "${OUTDIR}" || exit 1 else echo "running as root" > root disk_info - exectest sfdisk && sfdisk -d > ./sfdisk 2>./sfdisk.error + exectest dmidecode && dmidecode > ./dmidecode exectest dconf && dconf -o dconf @@ -394,6 +394,10 @@ cd "${OUTDIR}" || exit 1 fi for disk in $disklist; do + if exectest sfdisk && [[ -b "/dev/${disk}" ]] ; then + sfdisk -d "/dev/${disk}" > "./sfdisk_${disk}" 2>"./sfdisk_${disk}.error" + fi + if exectest smartctl ; then echo -e "smartctl -a /dev/${disk}:\n" >> smartctl smartctl -a "/dev/$disk" >> ./smartctl