diff options
Diffstat (limited to 'urunlevel/my_linux/Trinux/chkfixed')
-rwxr-xr-x | urunlevel/my_linux/Trinux/chkfixed | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/urunlevel/my_linux/Trinux/chkfixed b/urunlevel/my_linux/Trinux/chkfixed new file mode 100755 index 0000000..4cbb45b --- /dev/null +++ b/urunlevel/my_linux/Trinux/chkfixed | |||
@@ -0,0 +1,99 @@ | |||
1 | #!/bin/sh | ||
2 | # | ||
3 | # chkfixed - look for legitimate parititions and build mount points | ||
4 | # and populate /etc/proc | ||
5 | # | ||
6 | |||
7 | rm /tmp/partitions 2> /dev/null | ||
8 | |||
9 | |||
10 | [ -d /etc/proc ] || mkdir /etc/proc | ||
11 | |||
12 | if [ -f /etc/tux/config/fstab ] | ||
13 | then | ||
14 | echo "fstab found, exiting..." | ||
15 | exit 1 | ||
16 | fi | ||
17 | |||
18 | for i in `grep -v nodev /proc/filesystems` | ||
19 | do | ||
20 | echo "$i" | ||
21 | done > /etc/proc/availfs | ||
22 | |||
23 | echo "The following filesystems are supported:" | ||
24 | cat /etc/proc/availfs | ||
25 | echo | ||
26 | |||
27 | cdpart=`dmesg | grep D-ROM | grep hd | cut -d: -f1` | ||
28 | |||
29 | if [ "$cdpart" ] | ||
30 | then | ||
31 | echo "A CD-ROM was found at $cdpart" | ||
32 | echo "$cdpart" > /tmp/partitions | ||
33 | fi | ||
34 | |||
35 | partitions=`dmesg | grep ' hd[abcdef]' | cut -d':' -f2` | ||
36 | scsiparts=`dmesg | grep "^ sd[abcdef][12345]"` | ||
37 | |||
38 | echo IDE Partitions: $partitions | ||
39 | echo SCSI Partitions: $scsiparts | ||
40 | |||
41 | for i in $partitions | ||
42 | do | ||
43 | |||
44 | if echo "$partitions" | grep unknown > /dev/null | ||
45 | then | ||
46 | echo "Unkown partition" | ||
47 | else | ||
48 | echo $i >> /tmp/partitions | ||
49 | fi | ||
50 | done | ||
51 | |||
52 | for i in $partitions | ||
53 | do | ||
54 | |||
55 | if echo "$partitions" | grep unknown > /dev/null | ||
56 | then | ||
57 | echo "Unkown partition" | ||
58 | else | ||
59 | echo $i >> /tmp/partitions | ||
60 | fi | ||
61 | done | ||
62 | |||
63 | |||
64 | for i in $scsiparts | ||
65 | do | ||
66 | echo $i >> /tmp/partitions | ||
67 | done | ||
68 | |||
69 | if [ ! -f /tmp/partitions ] | ||
70 | then | ||
71 | echo "No fixed partitions found!" | ||
72 | exit | ||
73 | fi | ||
74 | |||
75 | sort /tmp/partitions | uniq | grep "hd" > /etc/proc/partitions | ||
76 | sort /tmp/partitions | uniq | grep "sd" >> /etc/proc/partitions | ||
77 | |||
78 | echo "The following partitions were found: " | ||
79 | cat /etc/proc/partitions | ||
80 | echo | ||
81 | |||
82 | ##echo "The following filesystems were found: " | ||
83 | for i in `cat /etc/proc/partitions` | ||
84 | do | ||
85 | mkdir /$i 2> /dev/null | ||
86 | |||
87 | for j in `cat /etc/proc/availfs` | ||
88 | do | ||
89 | echo -n Checking $i: | ||
90 | if mount -o ro -t $j /dev/$i /$i 2> /dev/null > /dev/null | ||
91 | then | ||
92 | echo " found $j" | ||
93 | echo "$i:$j" >> /etc/tux/config/fstab | ||
94 | umount /dev/$i 2> /dev/null > /dev/null | ||
95 | else | ||
96 | echo | ||
97 | fi | ||
98 | done | ||
99 | done | ||