summaryrefslogtreecommitdiffstats
path: root/urunlevel/my_linux/Trinux/chkfixed
diff options
context:
space:
mode:
Diffstat (limited to 'urunlevel/my_linux/Trinux/chkfixed')
-rwxr-xr-xurunlevel/my_linux/Trinux/chkfixed99
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
7rm /tmp/partitions 2> /dev/null
8
9
10[ -d /etc/proc ] || mkdir /etc/proc
11
12if [ -f /etc/tux/config/fstab ]
13then
14 echo "fstab found, exiting..."
15 exit 1
16fi
17
18for i in `grep -v nodev /proc/filesystems`
19do
20 echo "$i"
21done > /etc/proc/availfs
22
23echo "The following filesystems are supported:"
24cat /etc/proc/availfs
25echo
26
27cdpart=`dmesg | grep D-ROM | grep hd | cut -d: -f1`
28
29if [ "$cdpart" ]
30then
31 echo "A CD-ROM was found at $cdpart"
32 echo "$cdpart" > /tmp/partitions
33fi
34
35partitions=`dmesg | grep ' hd[abcdef]' | cut -d':' -f2`
36scsiparts=`dmesg | grep "^ sd[abcdef][12345]"`
37
38echo IDE Partitions: $partitions
39echo SCSI Partitions: $scsiparts
40
41for i in $partitions
42do
43
44 if echo "$partitions" | grep unknown > /dev/null
45 then
46 echo "Unkown partition"
47 else
48 echo $i >> /tmp/partitions
49 fi
50done
51
52for i in $partitions
53do
54
55 if echo "$partitions" | grep unknown > /dev/null
56 then
57 echo "Unkown partition"
58 else
59 echo $i >> /tmp/partitions
60 fi
61done
62
63
64for i in $scsiparts
65do
66 echo $i >> /tmp/partitions
67done
68
69if [ ! -f /tmp/partitions ]
70then
71 echo "No fixed partitions found!"
72 exit
73fi
74
75sort /tmp/partitions | uniq | grep "hd" > /etc/proc/partitions
76sort /tmp/partitions | uniq | grep "sd" >> /etc/proc/partitions
77
78echo "The following partitions were found: "
79cat /etc/proc/partitions
80echo
81
82##echo "The following filesystems were found: "
83for i in `cat /etc/proc/partitions`
84do
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
99done