Update ooo320-m1
[ooovba.git] / setup_native / scripts / install_create.pl
blob0aa8989c67d232cc6c7774238b09c4678c2ce951
1 : # -*- perl -*-
2 eval 'exec perl -wS $0 ${1+"$@"}'
3 if 0;
4 # create setup self extracting script
6 if( $#ARGV < 2 )
8 print <<ENDHELP;
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
14 ENDHELP
15 exit;
18 $infile = $ARGV[0];
19 $library = $ARGV[1];
20 $outfile = $ARGV[2];
21 $infile =~ tr/[A-Z]/[a-z]/;
23 # read script header
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)
31 chomp;
32 $_ =~ tr/\r//;
33 s/^\s*linenum=.*$/linenum=$linenum/;
34 print OUTFILE "$_\n";
36 close( SCRIPT );
37 close( OUTFILE );
39 system( "cat $library >>$outfile$$.tmp" );
40 rename "$outfile$$.tmp", "$outfile";
42 chmod 0775, $outfile;
44 exit;