2 # Make an Inno Setup distribution list, where files and dirs are represented by
5 # Name: {app}\backgrounds
8 # Source: C:\program\setup\about.htm; DestDir: {app}\; DestName: about.htm
11 # Usage: makeinno.sh sourcedir inno-topfile inno-bottomfile destfile
12 # For example: makeinno.sh c:/project/allfiles c:/project/innotop.txt c:/project/innobott.txt c:/project/project.iss
24 if [ "$SOURCEDIR" = "" ] || [ "$TOPFILE" = "" ] || [ "$BOTTOMFILE" = "" ] || [ "$INNOFILE" = "" ] ; then
28 if [ ! -d $SOURCEDIR ]; then
29 echo "Sorry, the source directory $SOURCEDIR does not exist."
33 if [ ! -f $TOPFILE ]; then
34 echo "Sorry, the Inno Setup header $TOPFILE does not exist."
38 if [ ! -f $BOTTOMFILE ]; then
39 echo "Sorry, the Inno Setup header $BOTTOMFILE does not exist."
43 if [ ! -d $TEMPDIR ]; then
53 if [ -f $thefile ]; then
54 sed -e "$theexpr" < $thefile > $thefile.tmp
55 mv $thefile.tmp
$thefile
57 echo "*** $thefile not found."
63 # SRCDIR=`cygpath -u $SRCDIR`
64 # DESTDIR=`cygpath -u $DESTDIR`
65 # TEMPDIR=`cygpath -u $TEMP`
68 # Generate a list of all files in the distribution.
69 # We pass the output through sed in order to remove the preceding "./"
71 find .
-print | sed -e "s/\.\\///g" > $TEMPDIR/files1.tmp
73 echo "[Dirs]" > $TEMPDIR/files2.tmp
75 for line
in `cat $TEMPDIR/files1.tmp` ; do
77 # If a directory, add to file
78 if [ -d $line ] ; then
80 # TODO: make into DOS filename form
81 #line2=`cygpath -w $line`
84 echo " Name: {app}\\"$line2 >> $TEMPDIR/files2.tmp
88 echo "" >> $TEMPDIR/files2.tmp
89 echo "[Files]" >> $TEMPDIR/files2.tmp
91 for line
in `cat $TEMPDIR/files1.tmp` ; do
93 # If not a directory, add to file
94 if [ ! -d $line ] ; then
96 # TODO: make into DOS filename form
97 #line2=`cygpath -w $line`
101 # TODO: make into DOS filename form
102 #line1=`cygpath -w $SOURCEDIR`"\\"$line2
103 line1
=$SOURCEDIR"\\"$line2
104 #pathonly=`find $line -printf "%h"`
105 pathonly
=`dirname $line`
107 echo " Source: "$line1"; DestDir: {app}\\"$pathonly >> $TEMPDIR/files2.tmp
111 echo "" >> $TEMPDIR/files2.tmp
113 doreplace
$TEMPDIR/files2.tmp
"s/\//\\\/g"
115 # Concatenate the 3 sections
116 cat $TOPFILE $TEMPDIR/files2.tmp
$BOTTOMFILE > $INNOFILE
118 rm -f $TEMPDIR/files1.tmp
123 echo Usage
: $PROGNAME sourcedir inno
-topfile inno
-bottomfile destfile
124 echo For example
: $PROGNAME c
:/project
/allfiles c
:/project
/innotop.txt c
:/project
/innobott.txt c
:/project
/project.iss
125 echo Remember to use paths of the form c
:/thing rather than
/c
/thing.