3 if [ -n "$debug" ] ; then
7 BIN_DIR=$(dirname "$0")
8 CORE_DIR=$(realpath "$BIN_DIR/..")
12 OUT_DIR="${CORE_DIR?}"
18 Usage: $0 [ --xz ] [ --bz2 ] [ --md5 ] [ --output-dir=<output location> ]
19 [ --core-dir=<core-repo-location ] [--version=<package_version] label
21 --xz generate a package compressed with xz (default)
22 --bz2 generate a package compressed with bz2. Note if you specify
23 both --cz and --bz2, both are created. if you specify neither
25 --md5 generate a md5 signature for the generated pacakge(s)
26 --output-dir where to put the generated packages
27 --core-dir location of the core repo to extract sources from.
28 by default this is one directory up from the position
30 --version version string used to generate the name of the pacakge
31 the source pacakge name is libreoffice-<version>.tar.[bz2|xz]
35 while [ "${1}" != "" ]; do
39 if [ "${1}" != "${parm?}" ] ; then
44 # echo "parm=!${parm}!"
57 if [ -z "${has_arg}" ] ; then
61 if [ -z "${arg}" ] ; then
62 echo "Missing argument for option $parm" 1>&2
69 if [ -z "${has_arg}" ] ; then
73 if [ -z "${arg}" ] ; then
74 echo "Missing argument for option $parm" 1>&2
85 echo "Invalid option $1" 1>&2
89 if [ -z "${LABEL}" ] ; then
92 echo "Too many arguments.. $@" 1>&2
101 if [ -z "${LABEL}" ] ; then
102 echo "Missing argument. we need a git label as source" 1>&2
106 # default to xz compression
107 if ! ${GEN_BZ2?} && ! ${GEN_XZ?} ; then
111 # --version= is mandatory
112 if [ -z "${VERSION}" ] ; then
116 base_name="libreoffice-${VERSION}"
118 # --output-dir default to core-dir
119 if [ -z "${OUT_DIR}" ] ; then
120 OUT_DIR="$CORE_DIR?}"
123 if [ ! -d "${CORE_DIR?}" ] ; then
124 echo "Core repo directory $CORE_DIR does not exist or is not a directory" 1>&2
128 if [ ! -d "${CORE_DIR?}/.git" ] ; then
129 echo "Core repo $CORE_DIR is not a git repo" 1>&2
133 if [ ! -d "${OUT_DIR?}" ] ; then
134 echo "Output directory $OUT_DIR does not exist or is not a directory" 1>&2
139 pushd "${CORE_DIR}" > /dev/null
142 echo "archiving core..."
143 git archive --format=tar --prefix="${base_name?}" -o "${OUT_DIR}/${base_name}.tar" ${LABEL?}
147 for module in dictionaries helcontent2 translations ; do
148 if [ ! -f ${module?}/.git ] ; then
149 echo "Warning: module $module is not present" 1>&2
151 echo "archiving ${module?}..."
152 git archive --format=tar --prefix="${base_name?}/${module?}" -o "${OUT_DIR}/${base_name}-${module?}.tar" ${LABEL?}
153 concatenate_list="${concatenate_list?} ${OUT_DIR}/${base_name}-${module?}.tar"
157 if [ -n "${concatenate_list?}" ] ; then
158 tar --concatenate --file="${OUT_DIR}/${base_name}.tar" ${concatenate_list?}
159 rm ${concatenate_list?}
162 if ${GEN_BZ2?} ; then
163 echo "bzip2 compression..."
164 bzip2 -fkz "${OUT_DIR}/${base_name}.tar"
165 if ${GEN_MD5?} ; then
167 md5sum "${OUT_DIR}/${base_name}.tar.bz2" > "${OUT_DIR}/${base_name}.tar.bz2.md5"
172 echo "xz compression..."
173 xz -fz "${OUT_DIR}/${base_name}.tar"
174 if ${GEN_MD5?} ; then
176 md5sum "${OUT_DIR}/${base_name}.tar.xz" > "${OUT_DIR}/${base_name}.tar.zx.md5"
179 rm "${OUT_DIR}/${base_name}.tar"