install windows 10 using ide disk and virtio.iso drivers
[gnt-info] / smart-query.sh
1 #!/bin/sh -e
2
3 test -e /tmp/s.last && rm /tmp/s.last
4
5 for col in "Device Model" "User Capacity" $*
6 do
7         # sed and sort is required for join later
8         grep "$col" /dev/shm/smart.sd* | sed \
9                 -e "s/$col: */ : /" \
10                 -e "s/[0-9]* $col .* \([0-9][0-9]*\)$/ : \1/" \
11         | sort > /tmp/s.this
12
13         if [ -e /tmp/s.last ] ; then
14                 join -a 1 /tmp/s.last /tmp/s.this > /tmp/s.new
15                 mv /tmp/s.new /tmp/s.last
16         else
17                 mv /tmp/s.this /tmp/s.last
18         fi
19 done
20
21 cat /tmp/s.last | sed -e 's!/dev/shm/smart.!!' -e 's/: : / : /'