60 lines
1.2 KiB
Bash
Executable file
60 lines
1.2 KiB
Bash
Executable file
#!/bin/bash
|
|
#$Id$
|
|
|
|
# Acknowledgment:
|
|
# The following code is a modified version of an original work written by
|
|
# Ken Moffat for their "farce" project and is included here with his
|
|
# permission.
|
|
#
|
|
|
|
set -e
|
|
|
|
: <<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
|
|
|
|
if [ $# -eq 2 ]; then
|
|
OUTFILE=$2
|
|
if [ -e $2 ]; then
|
|
echo -e "\nOutput $2 already exists\n"
|
|
exit
|
|
fi
|
|
else
|
|
echo -e "\nMissing argument\n"
|
|
exit 2
|
|
fi
|
|
|
|
if [ "$1" == "/" ]; then
|
|
LOC=$1
|
|
else
|
|
# ensure the path or mountpoint ends with a slash
|
|
# because of the seds after the 'find'
|
|
LOC=`echo $1 | sed 's%[^/]$%&/%'`
|
|
fi
|
|
|
|
echo -en "\nCreating file list for farce amalysis in $OUTFILE ..."
|
|
if [ -f $OUTFILE ]; then
|
|
echo "refusing to overwrite $OUTFILE"
|
|
exit 1
|
|
fi
|
|
|
|
# check we can indeed do this
|
|
>$OUTFILE
|
|
if [ $? -ne 0 ]; then
|
|
echo "error, cannot write to $OUTFILE"
|
|
exit 1
|
|
fi
|
|
|
|
find $LOC -xdev -xtype f | sed "s%^${LOC}%/%" | sort >$OUTFILE
|
|
|
|
echo -e "done.\n"
|
|
|
|
exit
|