Send various state changes to LOK
[LibreOffice.git] / setup_native / scripts / install_create.pl
blobc7659c40e31b1cf442089971d4ec183ff7805213
1 : # -*- perl -*-
2 eval 'exec perl -wS $0 ${1+"$@"}'
3 if 0;
5 # This file is part of the LibreOffice project.
7 # This Source Code Form is subject to the terms of the Mozilla Public
8 # License, v. 2.0. If a copy of the MPL was not distributed with this
9 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
11 # This file incorporates work covered by the following license notice:
13 # Licensed to the Apache Software Foundation (ASF) under one or more
14 # contributor license agreements. See the NOTICE file distributed
15 # with this work for additional information regarding copyright
16 # ownership. The ASF licenses this file to you under the Apache
17 # License, Version 2.0 (the "License"); you may not use this file
18 # except in compliance with the License. You may obtain a copy of
19 # the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 # create setup self extracting script
23 if( $#ARGV < 2 )
25 print <<ENDHELP;
26 USAGE: $0 <inputshellscript> <libraryfile> <outputshellscript>
27 <inputshellscript>: the start shell script, located next to this perl script
28 <libraryfile>: the library file, that is included into the shell script
29 <outfile>: the target shellscript
31 ENDHELP
32 exit;
35 $infile = $ARGV[0];
36 $library = $ARGV[1];
37 $outfile = $ARGV[2];
39 # read script header
40 open( SCRIPT, "<$infile" ) || die "cannot open $infile";
41 open( OUTFILE, ">$outfile$$.tmp" ) || die "cannot open $outfile";
42 @scriptlines = <SCRIPT>;
43 $linenum = $#scriptlines+2;
44 foreach (@scriptlines)
46 # lineend conversion (be on the safe side)
47 chomp;
48 $_ =~ tr/\r//;
49 s/^\s*linenum=.*$/linenum=$linenum/;
50 print OUTFILE "$_\n";
52 close( SCRIPT );
53 close( OUTFILE );
55 system( "cat $library >>$outfile$$.tmp" );
56 rename "$outfile$$.tmp", "$outfile";
58 chmod 0775, $outfile;
60 exit;