core145: found more urlfilter db files to cleanup
[ipfire-2.x.git] / src / scripts / scanhd
1 #!/bin/bash
2 case "$1" in
3         ide)
4                 rm -f /var/ipfire/extrahd/scan
5                 for DEV in `find /sys/block/* -maxdepth 0 ! -name sr* ! -name ram* ! -name loop* -exec basename {} \; | sort | uniq`
6                 do
7                         VENDOR=`cat /sys/block/$DEV/device/vendor 2>/dev/null`
8                         MODEL=`cat /sys/block/$DEV/device/model 2>/dev/null`
9                         REV=`cat /sys/block/$DEV/device/rev 2>/dev/null`
10                         echo "$DEV;$VENDOR $MODEL $REV" >> /var/ipfire/extrahd/scan
11                 done
12                 ;;
13         partitions)
14                 cat /proc/partitions | awk '{print $4 " " $3 }' | grep -v name | grep -v "^[[:space:]]*$" | \
15                         while read device size; do
16                                 [ -z "${device}" ] && continue
17                                 echo "${device};${size};$(blkid -c /dev/null -s UUID -o value /dev/${device});"
18                         done > /var/ipfire/extrahd/partitions
19                 ;;
20         *)
21                 echo "Usage: $0 (ide|partitions)"
22                 ;;
23 esac