Updated uuid_fix.sh to support blkid output w/ LABELs as well as UUIDs
[bootimage-initfs.git] / etc / logdev.sh
1 #!/bin/ash
2
3 # mount a logging device
4 for i in `ls -1d /sys/block/sd[a-z] /sys/block/hd[a-z] 2>/dev/null`
5 do
6         REMOVABLE=$(< ${i}/removable)
7         if [ "${REMOVABLE}" != 1 ]
8         then
9                 ls -l ${i}/device | grep usb > /dev/null
10                 if [ $? != 0 ]
11                 then
12                         continue # skip non-removable, non-usb devices
13                 fi
14         fi
15         #DEV_NAME=`basename ${i}`
16         #vol_id -x /dev/${DEV_NAME} > /tmp/vol_id.tmp
17         #if [ $? != 0 ] # no file system found
18         #then
19                 for j in `ls -1d ${i}/?d?[0-9] 2>/dev/null`
20                 do
21                         DEV_NAME=`basename ${j}`
22                         #vol_id -x /dev/${DEV_NAME} > /tmp/vol_id.tmp
23                         #if [ $? = 0 ]
24                         #then
25                                 #source /tmp/vol_id.tmp # might use these variables some day
26                                 mount /dev/${DEV_NAME} /var/logdev
27                                 touch /var/logdev/breakin.log
28                                 echo "Logging device found at ${DEV_NAME}."
29                                 break 2
30                         #fi
31                 done
32         #else # found file system
33         #       #source /tmp/vol_id.tmp # might use these variables some day
34         #       mount /dev/${DEV_NAME} /var/logdev
35         #       touch /var/logdev/breakin.log
36         #       echo "Logging device found at ${DEV_NAME}."
37         #       exit 0
38         #fi
39 done
40
41 echo "No logging device found."
42