#!/bin/bash

piece=$1
ooo_build_tag=$2

source $OO_TOOLSDIR/piece/sys-setup

# testtool subapckage
$OO_TOOLSDIR/piece/merge-file-lists "files-testtool.txt" $DESTDIR/gid_Module_Optional_Testtool

# generate the common file list
$OO_TOOLSDIR/piece/merge-file-lists "files-$piece.txt" $DESTDIR/gid_*

# officebean subpackage
mv_file_between_flists files-officebean.txt files-$piece.txt $OO_INSTDIR/basis$VERSION/program/classes/officebean.jar
mv_file_between_flists files-officebean.txt files-$piece.txt $OO_INSTDIR/basis$VERSION/program/libofficebean.so
add_used_directories files-officebean.txt files-$piece.txt

# prune redundant files the scp2 likes to make for us
remove_file "files-$piece.txt" "$OO_INSTDIR/basis-link"
remove_file "files-$piece.txt" "$OO_INSTDIR/basis$VERSION/ure-link"
remove_dir  "files-$piece.txt" "$OO_INSTDIR/ure"

# solver is not in the file list, so rm is enough
rm -f "$DESTDIR/$OO_INSTDIR/solver/bin/packinfo*.txt"
rm -f "$DESTDIR/$OO_INSTDIR/solver/bin/userland.txt"

exit 0
