#!/bin/sh if [ "$VIRCADIA" = "" ]; then VIRCADIA=`realpath ../..` fi GITDATE=`git -C $VIRCADIA/source log -n 1 --format=raw | grep author | cut -d">" -f 2 | cut -d" " -f 2 | xargs -I {} date -d @{} +"%Y%m%d"` GITCOMMIT=`git -C $VIRCADIA/source rev-parse HEAD | cut -c 1-7` VERSION=$DEBVERSION-$GITDATE-$GITCOMMIT sudo apt-get install chrpath binutils dh-make DEB_BUILD_ROOT=temp-make-deb/vircadia-server_$VERSION-0ubuntu1 rm -r temp-make-deb mkdir -p $DEB_BUILD_ROOT # copy the files over cp $VIRCADIA/build/assignment-client/assignment-client $DEB_BUILD_ROOT cp $VIRCADIA/build/domain-server/domain-server $DEB_BUILD_ROOT cp $VIRCADIA/build/tools/oven/oven $DEB_BUILD_ROOT cp $VIRCADIA/build/libraries/*/*.so $DEB_BUILD_ROOT #cp $VIRCADIA/build/ice-server/ice-server $DEB_BUILD_ROOT chrpath -d $DEB_BUILD_ROOT/* cp $VIRCADIA/qt5-install/lib/libQt5Network.so.*.*.* $DEB_BUILD_ROOT cp $VIRCADIA/qt5-install/lib/libQt5Core.so.*.*.* $DEB_BUILD_ROOT cp $VIRCADIA/qt5-install/lib/libQt5Widgets.so.*.*.* $DEB_BUILD_ROOT cp $VIRCADIA/qt5-install/lib/libQt5Gui.so.*.*.* $DEB_BUILD_ROOT cp $VIRCADIA/qt5-install/lib/libQt5Script.so.*.*.* $DEB_BUILD_ROOT cp $VIRCADIA/qt5-install/lib/libQt5WebSockets.so.*.*.* $DEB_BUILD_ROOT cp $VIRCADIA/qt5-install/lib/libQt5Qml.so.*.*.* $DEB_BUILD_ROOT cp $VIRCADIA/qt5-install/lib/libQt5ScriptTools.so.*.*.* $DEB_BUILD_ROOT chmod +x $DEB_BUILD_ROOT/*.so.*.*.* strip --strip-all $DEB_BUILD_ROOT/* cp $VIRCADIA/source/pkg-scripts/new-server $DEB_BUILD_ROOT cp -a $VIRCADIA/source/domain-server/resources $DEB_BUILD_ROOT find $DEB_BUILD_ROOT/resources -name ".gitignore" -delete find $DEB_BUILD_ROOT/resources -type f -executable -exec sh -c 'chmod -x {}' \; cp $VIRCADIA/source/README.md $DEB_BUILD_ROOT cp $VIRCADIA/source/README_hifi.md $DEB_BUILD_ROOT cp -a $VIRCADIA/build/assignment-client/plugins $DEB_BUILD_ROOT strip --strip-all $DEB_BUILD_ROOT/plugins/*.so strip --strip-all $DEB_BUILD_ROOT/plugins/*/*.so #begin the debian package construction cd $DEB_BUILD_ROOT dh_make -p vircadia-server_$VERSION-0ubuntu1 -c apache -s --createorig -y cp $VIRCADIA/source/pkg-scripts/vircadia-assignment-client.service debian cp $VIRCADIA/source/pkg-scripts/vircadia-assignment-client@.service debian cp $VIRCADIA/source/pkg-scripts/vircadia-domain-server.service debian cp $VIRCADIA/source/pkg-scripts/vircadia-domain-server@.service debian #cp $VIRCADIA/source/pkg-scripts/vircadia-ice-server.service debian #cp $VIRCADIA/source/pkg-scripts/vircadia-ice-server@.service debian cp $VIRCADIA/source/pkg-scripts/vircadia-server.target debian cp $VIRCADIA/source/pkg-scripts/vircadia-server@.target debian cp $VIRCADIA/source/pkg-scripts/server-control debian/control cp $VIRCADIA/source/pkg-scripts/server-prerm debian/prerm cp $VIRCADIA/source/pkg-scripts/server-postinst debian/postinst cp $VIRCADIA/source/pkg-scripts/server-postrm debian/postrm cp $VIRCADIA/source/LICENSE debian/copyright echo /etc/opt/vircadia > debian/dirs echo /var/lib/vircadia >> debian/dirs echo README.md > debian/docs echo README_hifi.md >> debian/docs echo assignment-client opt/vircadia > debian/install echo domain-server opt/vircadia >> debian/install echo oven opt/vircadia >> debian/install #echo ice-server opt/vircadia >> debian/install echo new-server opt/vircadia >> debian/install for so in *.so.*.*.*; do echo $so opt/vircadia/lib >> debian/install done for so in *.so; do echo $so opt/vircadia/lib >> debian/install done #for service in *.service; do # echo $service opt/vircadia/systemd >> debian/install #done #for target in *.target; do # echo $target opt/vircadia/systemd >> debian/install #done find resources -type f -exec sh -c 'echo {} opt/vircadia/$(dirname "{}") >> debian/install' \; find plugins -type f -exec sh -c 'echo {} opt/vircadia/$(dirname "{}") >> debian/install' \; SOFILES=`ls *.so *.so.*.*.* | grep -Po '^(.+\.so(\.\d+)?)' | sed 's/\./\\\./g' | paste -d'|' -s` DEPENDS=`find * -path debian -prune -o -type f -executable -exec sh -c 'objdump -p {} | grep NEEDED' \; \ | awk '{print $2}' | sort | uniq | egrep -v "^($SOFILES)$" \ | xargs -n 1 -I {} sh -c 'dpkg -S {} | head -n 1' | cut -d ':' -f 1 | sort | uniq | paste -d',' -s` cp $VIRCADIA/source/pkg-scripts/server-rules debian/rules sed "s/{DEPENDS}/$DEPENDS/" $VIRCADIA/source/pkg-scripts/server-control > debian/control dpkg-buildpackage -us -uc cd .. mv *.deb .. cd ..