2 eval 'exec perl -wS $0 ${1+"$@"}'
4 # create setup self extracting script
9 USAGE: $0 <inputshellscript> <libraryfile> <outputshellscript>
10 <inputshellscript>: the start shell script, located next to this perl script
11 <libraryfile>: the library file, that is included into the shell script
12 <outfile>: the target shellscript
21 $infile =~ tr/[A-Z]/[a-z]/;
24 open( SCRIPT
, "<$infile" ) || die "cannot open $infile";
25 open( OUTFILE
, ">$outfile$$.tmp" ) || die "cannot open $outfile";
26 @scriptlines = <SCRIPT
>;
27 $linenum = $#scriptlines+2;
28 foreach (@scriptlines)
30 # lineend conversion (be on the safe side)
33 s/^\s*linenum=.*$/linenum=$linenum/;
39 system( "cat $library >>$outfile$$.tmp" );
40 rename "$outfile$$.tmp", "$outfile";