]>
git.ipfire.org Git - ipfire-2.x.git/blob - src/hwinfo/gen-hwcfg-disk.sh
5 # Generates hwcfg file for all configured disks
8 if [ -x /sbin
/ata_identify
]; then
9 ATA_ID
=/sbin
/ata_identify
10 elif [ -x /lib
/klibc
/bin
/ata_identify
]; then
11 ATA_ID
=/lib
/klibc
/bin
/ata_identify
13 echo "ata_identify not found, please install udev"
17 hwcfg
=/etc
/sysconfig
/hardware
19 if [ ! -d "$hwcfg" ]; then
20 echo "No hardware configuration directory found"
25 for ifname
in /sys
/block
/hd
*; do
26 id
=$
($ATA_ID /dev
/${ifname##*/} 2> /dev
/null
)
29 echo "Generate hwcfg file for $filename"
30 echo "DEVICE=${ifname##*/}" > ${hwcfg}/hwcfg-disk-id-${filename}
35 for ifname in /sys/block/sd*; do
36 if [ -d $ifname/device ]; then
37 read vendor < $ifname/device/vendor
38 if [ "$vendor" = "ATA
" ]; then
39 # We need page 0x80 to get the serial number
44 scsi_id -g $page -s ${ifname#/sys} 2> /dev/null | while read vendor model serial; do
45 filename="${vendor}_${model}_${serial}"
46 echo "Generate hwcfg
file for $filename"
47 echo "DEVICE
=${ifname##*/}" > ${hwcfg}/hwcfg-disk-id-${filename}