2 eval 'exec perl -wS $0 ${1+"$@"}'
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
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
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)
49 s/^\s*linenum=.*$/linenum=$linenum/;
55 system( "cat $library >>$outfile$$.tmp" );
56 rename "$outfile$$.tmp", "$outfile";