source: extras/filelist@ 00f4966

experimental
Last change on this file since 00f4966 was 34cabf6, checked in by Manuel Canales Esparcia <manuel@…>, 19 years ago

Creating iteration-N.log files to keep clean Makefile output.

  • Property mode set to 100755
File size: 1.2 KB
RevLine 
[de313b3]1#!/bin/bash
[f4f7d18]2#$Id$
[dc526ea]3
[f4f7d18]4# Acknowledgment:
5# The following code is a modified version of an original work written by
[2faca44]6# Ken Moffat for their "farce" project and is included here with his
[f4f7d18]7# permission.
8#
[dc526ea]9
[f4f7d18]10set -e
[dc526ea]11
[f4f7d18]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:
22inline_doc
[dc526ea]23
24if [ $# -eq 2 ]; then
[f4f7d18]25 OUTFILE=$2
26 if [ -e $2 ]; then
27 echo -e "\nOutput $2 already exists\n"
28 exit
29 fi
[dc526ea]30else
[f4f7d18]31 echo -e "\nMissing argument\n"
32 exit 2
[dc526ea]33fi
34
35if [ "$1" == "/" ]; then
[f4f7d18]36 LOC=$1
[dc526ea]37else
[f4f7d18]38 # ensure the path or mountpoint ends with a slash
39 # because of the seds after the 'find'
40 LOC=`echo $1 | sed 's%[^/]$%&/%'`
[dc526ea]41fi
42
[34cabf6]43echo -en "\nCreating file list for farce amalysis in $OUTFILE ..."
[dc526ea]44if [ -f $OUTFILE ]; then
[f4f7d18]45 echo "refusing to overwrite $OUTFILE"
46 exit 1
[dc526ea]47fi
48
49# check we can indeed do this
50>$OUTFILE
51if [ $? -ne 0 ]; then
[f4f7d18]52 echo "error, cannot write to $OUTFILE"
53 exit 1
[dc526ea]54fi
55
[f4f7d18]56find $LOC -xdev -xtype f | sed "s%^${LOC}%/%" | sort >$OUTFILE
[dc526ea]57
[34cabf6]58echo -e "done.\n"
59
[dc526ea]60exit
Note: See TracBrowser for help on using the repository browser.