2006-04-09 20:14:49 +02:00
|
|
|
#!/bin/bash
|
2006-04-09 20:07:03 +02:00
|
|
|
#$Id$
|
2006-04-09 10:49:42 +02:00
|
|
|
|
2006-04-09 20:07:03 +02:00
|
|
|
# Acknowledgment:
|
|
|
|
# The following code is a modified version of an original work written by
|
2006-04-09 20:42:49 +02:00
|
|
|
# Ken Moffat for their "farce" project and is included here with his
|
2006-04-09 20:07:03 +02:00
|
|
|
# permission.
|
|
|
|
#
|
2006-04-09 10:49:42 +02:00
|
|
|
|
2006-04-09 20:07:03 +02:00
|
|
|
set -e
|
2006-04-09 10:49:42 +02:00
|
|
|
|
2006-04-09 20:07:03 +02:00
|
|
|
: <<inline_doc
|
|
|
|
desc: creates farce file lists
|
|
|
|
usage: filelist $DEST_FARCE/$ITERATION $DEST_FARCE/$ITERATION.filelist
|
|
|
|
input vars: $1 directory where files from current iteration are stored
|
|
|
|
$2 name of the file list to be created
|
|
|
|
externals: --
|
|
|
|
modifies: --
|
|
|
|
returns: --
|
|
|
|
on error:
|
|
|
|
on success:
|
|
|
|
inline_doc
|
2006-04-09 10:49:42 +02:00
|
|
|
|
|
|
|
if [ $# -eq 2 ]; then
|
2006-04-09 20:07:03 +02:00
|
|
|
OUTFILE=$2
|
|
|
|
if [ -e $2 ]; then
|
|
|
|
echo -e "\nOutput $2 already exists\n"
|
|
|
|
exit
|
|
|
|
fi
|
2006-04-09 10:49:42 +02:00
|
|
|
else
|
2006-04-09 20:07:03 +02:00
|
|
|
echo -e "\nMissing argument\n"
|
|
|
|
exit 2
|
2006-04-09 10:49:42 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$1" == "/" ]; then
|
2006-04-09 20:07:03 +02:00
|
|
|
LOC=$1
|
2006-04-09 10:49:42 +02:00
|
|
|
else
|
2006-04-09 20:07:03 +02:00
|
|
|
# ensure the path or mountpoint ends with a slash
|
|
|
|
# because of the seds after the 'find'
|
|
|
|
LOC=`echo $1 | sed 's%[^/]$%&/%'`
|
2006-04-09 10:49:42 +02:00
|
|
|
fi
|
|
|
|
|
2006-04-14 18:46:50 +02:00
|
|
|
echo -en "\nCreating file list for farce amalysis in $OUTFILE ..."
|
2006-04-09 10:49:42 +02:00
|
|
|
if [ -f $OUTFILE ]; then
|
2006-04-09 20:07:03 +02:00
|
|
|
echo "refusing to overwrite $OUTFILE"
|
|
|
|
exit 1
|
2006-04-09 10:49:42 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
# check we can indeed do this
|
|
|
|
>$OUTFILE
|
|
|
|
if [ $? -ne 0 ]; then
|
2006-04-09 20:07:03 +02:00
|
|
|
echo "error, cannot write to $OUTFILE"
|
|
|
|
exit 1
|
2006-04-09 10:49:42 +02:00
|
|
|
fi
|
|
|
|
|
2006-04-09 20:07:03 +02:00
|
|
|
find $LOC -xdev -xtype f | sed "s%^${LOC}%/%" | sort >$OUTFILE
|
2006-04-09 10:49:42 +02:00
|
|
|
|
2006-04-14 18:46:50 +02:00
|
|
|
echo -e "done.\n"
|
|
|
|
|
2006-04-09 10:49:42 +02:00
|
|
|
exit
|