source:
extras/filelist@
bfc3db7
Last change on this file since bfc3db7 was 45f82718, checked in by , 19 years ago | |
---|---|
|
|
File size: 1.2 KB |
Rev | Line | |
---|---|---|
[45f82718] | 1 | #!/bin/bash |
2 | #$Id$ | |
3 | ||
4 | # Acknowledgment: | |
5 | # The following code is a modified version of an original work written by | |
6 | # Ken Moffat for their "farce" project and is included here with his | |
7 | # permission. | |
8 | # | |
9 | ||
10 | set -e | |
11 | ||
12 | : <<inline_doc | |
13 | desc: creates farce file lists | |
14 | usage: filelist $DEST_FARCE/$ITERATION $DEST_FARCE/$ITERATION.filelist | |
15 | input vars: $1 directory where files from current iteration are stored | |
16 | $2 name of the file list to be created | |
17 | externals: -- | |
18 | modifies: -- | |
19 | returns: -- | |
20 | on error: | |
21 | on success: | |
22 | inline_doc | |
23 | ||
24 | if [ $# -eq 2 ]; then | |
25 | OUTFILE=$2 | |
26 | if [ -e $2 ]; then | |
27 | echo -e "\nOutput $2 already exists\n" | |
28 | exit | |
29 | fi | |
30 | else | |
31 | echo -e "\nMissing argument\n" | |
32 | exit 2 | |
33 | fi | |
34 | ||
35 | if [ "$1" == "/" ]; then | |
36 | LOC=$1 | |
37 | else | |
38 | # ensure the path or mountpoint ends with a slash | |
39 | # because of the seds after the 'find' | |
40 | LOC=`echo $1 | sed 's%[^/]$%&/%'` | |
41 | fi | |
42 | ||
43 | echo -en "\nCreating file list for farce amalysis in $OUTFILE ..." | |
44 | if [ -f $OUTFILE ]; then | |
45 | echo "refusing to overwrite $OUTFILE" | |
46 | exit 1 | |
47 | fi | |
48 | ||
49 | # check we can indeed do this | |
50 | >$OUTFILE | |
51 | if [ $? -ne 0 ]; then | |
52 | echo "error, cannot write to $OUTFILE" | |
53 | exit 1 | |
54 | fi | |
55 | ||
56 | find $LOC -xdev -xtype f | sed "s%^${LOC}%/%" | sort >$OUTFILE | |
57 | ||
58 | echo -e "done.\n" | |
59 | ||
60 | exit |
Note:
See TracBrowser
for help on using the repository browser.