summaryrefslogtreecommitdiffstats
path: root/scripts/contrib/ddimage
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/contrib/ddimage')
-rwxr-xr-xscripts/contrib/ddimage25
1 files changed, 20 insertions, 5 deletions
diff --git a/scripts/contrib/ddimage b/scripts/contrib/ddimage
index 93ebeafc31..a503f11d0d 100755
--- a/scripts/contrib/ddimage
+++ b/scripts/contrib/ddimage
@@ -1,7 +1,8 @@
1#!/bin/sh 1#!/bin/sh
2 2
3#BLACKLIST_DEVICES="/dev/sda /dev/sdb /dev/sdc /dev/sdd /dev/sde" 3# Default to avoiding the first two disks on typical Linux and Mac OS installs
4BLACKLIST_DEVICES="/dev/sda" 4# Better safe than sorry :-)
5BLACKLIST_DEVICES="/dev/sda /dev/sdb /dev/disk1 /dev/disk2"
5 6
6# 1MB blocksize 7# 1MB blocksize
7BLOCKSIZE=1048576 8BLOCKSIZE=1048576
@@ -14,9 +15,15 @@ image_details() {
14 IMG=$1 15 IMG=$1
15 echo "Image details" 16 echo "Image details"
16 echo "=============" 17 echo "============="
17 echo " image: $(stat --printf '%N\n' $IMG)" 18 echo " image: $(basename $IMG)"
18 echo " size: $(stat -L --printf '%s bytes\n' $IMG)" 19 # stat format is different on Mac OS and Linux
19 echo " modified: $(stat -L --printf '%y\n' $IMG)" 20 if [ "$(uname)" = "Darwin" ]; then
21 echo " size: $(stat -L -f '%z bytes' $IMG)"
22 echo " modified: $(stat -L -f '%Sm' $IMG)"
23 else
24 echo " size: $(stat -L -c '%s bytes' $IMG)"
25 echo " modified: $(stat -L -c '%y' $IMG)"
26 fi
20 echo " type: $(file -L -b $IMG)" 27 echo " type: $(file -L -b $IMG)"
21 echo "" 28 echo ""
22} 29}
@@ -27,6 +34,14 @@ device_details() {
27 34
28 echo "Device details" 35 echo "Device details"
29 echo "==============" 36 echo "=============="
37
38 # Collect disk info using diskutil on Mac OS
39 if [ "$(uname)" = "Darwin" ]; then
40 diskutil info $DEVICE | egrep "(Device Node|Media Name|Total Size)"
41 return
42 fi
43
44 # Default / Linux information collection
30 echo " device: $DEVICE" 45 echo " device: $DEVICE"
31 if [ -f "/sys/class/block/$DEV/device/vendor" ]; then 46 if [ -f "/sys/class/block/$DEV/device/vendor" ]; then
32 echo " vendor: $(cat /sys/class/block/$DEV/device/vendor)" 47 echo " vendor: $(cat /sys/class/block/$DEV/device/vendor)"