Teaspeak-Server/server/repro/package_server.sh

45 lines
1.2 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
2020-12-02 17:40:36 -05:00
# shellcheck disable=SC2207
BUILD_INFO=($(cat build_version.txt))
BUILD_FULL_NAME=${BUILD_INFO[0]}
BUILD_NAME=${BUILD_INFO[1]}
BUILD_VERSION=${BUILD_INFO[2]}
BUILD_FILENAME=${BUILD_INFO[3]}
echo "Creating TeaSpeak ${BUILD_NAME} Build index ${BUILD_VERSION}"
2019-11-11 15:37:28 -05:00
if [[ -d finalenv ]]; then
rm -r finalenv
fi
cp -r env finalenv
2019-11-11 15:37:28 -05:00
cd finalenv || {
echo "failed to enter dir"
exit 1
}
echo -e "# Version: ${BUILD_FULL_NAME}
# TeaSpeak version: ${BUILD_NAME}
# Build version: ${BUILD_VERSION}
2020-01-24 13:39:43 -05:00
{\"build_name\": \"${BUILD_FULL_NAME}\", \"build_version\": \"${BUILD_NAME}\", \"build_index\": ${BUILD_VERSION}}" > buildVersion.txt
2020-12-02 17:40:36 -05:00
echo "Stripping symbols"
2020-01-24 16:55:23 -05:00
strip -s -p -v TeaSpeakServer || { echo "failed to strip symbols!"; exit 1; }
patchelf --set-rpath ./libs/ TeaSpeakServer || { echo "failed to set rpath!"; exit 1; }
2020-12-02 17:40:36 -05:00
cd libs/ || exit 1
for file in *.so*; do
echo "Editing rpath for $file"
strip --strip-all "$file"
patchelf --set-rpath "./libs/:./" "$file"
done
cd ..
2020-01-25 10:12:18 -05:00
tar --dereference -cvf - * | gzip -f -9 > "../${BUILD_FILENAME}"
[[ $? -ne 0 ]] && { echo "failed to package server"; exit 1; }
2020-01-25 10:00:21 -05:00
cd ..
2019-11-22 15:47:16 -05:00
rm -r finalenv
echo "Package created (${BUILD_FILENAME})"