|
|
1.1 root 1: #!/bin/sh
2:
3: # This is an example shell script that can be used as a wrapper for a
4: # msdos.fsck (called by the generic fsck frontend).
5: #
6: # This script is the second version. It uses a new feature of libdmsdos,
7: # the built-in direct translation that can access a CVF even if the host
8: # filesystem is not mounted. This is now the preferred way.
9: #
10: # The script accepts a standard fsck command line and decides upon the
11: # the raw filesystem data whether it is a CVF or not. If it is a CVF then
12: # dmsdosfsck is invoked.
13: #
14: # The case when it is not a CVF but an uncompressed msdos partition is a bit
15: # more complex. First, dosfsck is invoked to check that dos partition. Then
16: # the script scans its root directory for CVFs. If there are CVFs it tries
17: # to check them, too, by calling dmsdosfsck on them. If the -r option is
18: # present in the fsck command line, some questions are asked.
19: #
20: # Note that this script needs a helper program that finds out whether a
21: # file is a CVF or not. If you have added the file(1) magics for CVFs to
22: # /etc/magic (see the dmsdos installation instructions) you can use a
23: # combination of file and grep (for example) for that purpose. I think this
24: # is a standard way. If you still prefer the older method (by calling the
25: # helper program cvftest) just compile cvftest ('make cvftest') and change
26: # one lines below (I've commented out the cvftest call and placed a
27: # file command in the next line).
28:
29: ###########################################################################
30:
31: # where to find the different filesystem checker utilities
32: DMSDOSFSCK="dmsdosfsck"
33: DOSFSCK="dosfsck"
34: CVFLIST="cvflist"
35:
36: ARGS="$@"
37: FILE=""
38: ASK=n
39:
40: while [ "$1" != "" ];
41: do
42: case "$1" in
43: -u) shift
44: shift ;;
45: -d) shift
46: shift ;;
47: -r) ASK=y
48: shift ;;
49: -*) shift ;;
50: *) FILE="$1"
51: shift ;;
52: esac;
53: done
54:
55: #echo "ARGS=$ARGS"
56: #echo "FILE=$FILE"
57:
58: #if cvftest $FILE ;
59: if [ ! -z "`file $FILE | grep CVF`" ];
60: then
61: echo "CVF detected, calling dmsdosfsck ..."
62: $DMSDOSFSCK $ARGS
63: CODE="$?"
64: else
65: echo "no CVF found, calling dosfsck ..."
66: $DOSFSCK $ARGS
67: CODE="$?"
68: if [ "$CODE" != "0" ];
69: then
70: exit $CODE
71: fi
72: if [ $ASK = y ];
73: then
74: echo -n "search $FILE for CVFs in it and check them, too?"
75: read ANS JUNK
76: if [ "$ANS" != "y" -a "$ANS" != "Y" ];
77: then
78: exit 0
79: fi
80: fi
81: CVFS=`$CVFLIST $FILE`
82: if [ -z "$CVFS" ];
83: then
84: echo "no CVFs found."
85: exit 0
86: fi
87:
88: CODE="0"
89: for I in $CVFS
90: do
91: I=`echo $I | cut -f2 -d.`
92: echo "checking CVF with ext $I ..."
93: $DMSDOSFSCK $ARGS $FILE:$I
94: if [ "$?" != "0" ];
95: then
96: CODE="$?"
97: fi
98: done
99: fi
100:
101: exit $CODE
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.