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/.
13 echo "Helper script to unpack the LO source tarballs"
15 echo "Usage: ${0##*/} [--help] start-dir tarball..."
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"
27 while test -n "$1" ; do
37 echo "Error: unknown option: $1"
41 if test -z "$start_dir" ; then
44 tarballs
="$tarballs $1"
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
; then
56 echo "Error: $start_dir is not a valid LibreOffice core source directory"
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"
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"
76 echo "Unpacking $tarname..."
77 echo mkdir
-p "$lo_src_dir/$tarname"
78 if ! mkdir
-p "$lo_src_dir/$tarname" ; then
79 echo "Error: could not create directory $lo_src_dir/$tarname"
81 echo tar -xf "$tarball" -C "$lo_src_dir/$tarname" --strip-components=1
82 if ! tar -xf "$tarball" -C "$lo_src_dir/$tarname" --strip-components=1; then
83 echo "Error: could not unpack $tarname"
87 # create symlinks for module directories; ignore git-hooks directory
89 ln -sf "src/${tarname}/$(basename "$dir")" "$start_dir"
90 done < <(find "$lo_src_dir/$tarname" -mindepth 1 -maxdepth 1 -type d
-path $lo_src_dir/$tarname/git-hooks
)