bump product version to 4.1.6.2
[LibreOffice.git] / bin / unpack-sources
blob4b0f9beb0c8dab3b545d3ba0ead8de2609611b23
1 #!/usr/bin/env bash
4 # This file is part of the LibreOffice project.
6 # This Source Code Form is subject to the terms of the Mozilla Public
7 # License, v. 2.0. If a copy of the MPL was not distributed with this
8 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
11 usage()
13 echo "Helper script to unpack the LO source tarbals"
14 echo
15 echo "Usage: ${0##*/} [--help] start-dir tarball..."
16 echo
17 echo "Options:"
18 echo
19 echo " --help this help"
20 echo " start-dir path where the sources are unpacked (bootstrap directory)"
21 echo " tarball list of LO source tarball that need to be unpacked"
24 start_dir=
25 tarballs=
27 while test -n "$1" ; do
28 case "$1" in
29 --help)
30 usage
31 exit 0;
33 --download)
34 download="yes"
36 -*)
37 echo "Error: unknown option: $1"
38 exit 1;
41 if test -z "$start_dir" ; then
42 start_dir="$1"
43 else
44 tarballs="$tarballs $1"
47 esac
48 shift
49 done
51 if test -z "$start_dir" ; then
52 echo "Error: Please, define where to unpack sources, try --help"
55 if ! test -f $start_dir/Repository.mk -a -f $start_dir/solenv/inc/target.mk ; then
56 echo "Error: $start_dir is not a valid LibreOffice core source directory"
57 exit 1;
60 if test ! -f $start_dir/sources.ver -o -d $start_dir/.git ; then
61 echo "Warning: sources are from git and not from tarball"
62 echo " Do nothing."
63 exit 0;
66 lo_src_dir="$start_dir/src"
67 mkdir -p "$lo_src_dir"
69 for tarball in $tarballs ; do
70 tarname=`basename $tarball | sed -e "s/\.tar\..*//"`
71 if test -d $lo_src_dir/$tarname ; then
72 echo "Warning: $lo_src_dir/$tarname already exists => skipping"
73 continue;
76 echo "Unpacking $tarname..."
77 echo tar -xf "$tarball" -C "$lo_src_dir"
78 tar -xf "$tarball" -C "$lo_src_dir"
80 # create symlinks for module directories; ignore git-hooks directory
81 for dir in `find "$lo_src_dir/$tarname" -mindepth 1 -maxdepth 1 -type d -path $lo_src_dir/$tarname/git-hooks -o -printf "$tarname/%f\n"` ; do
82 ln -sf "src/$dir" "$start_dir"
83 done
84 done