minecraft-pi-docker/scripts/package.sh

69 lines
1.6 KiB
Bash
Raw Normal View History

2020-09-27 00:48:46 +00:00
#!/bin/sh
2020-12-04 21:27:28 +00:00
# Current Version
DEB_VERSION='1.0.0'
2020-09-27 00:48:46 +00:00
set -e
# Docker Messes With SetGID
chmod -R g-s debian
# Clean out Directory
rm -rf out
2020-10-03 20:18:53 +00:00
mkdir -p out/deb
2020-09-27 00:48:46 +00:00
2020-12-04 21:27:28 +00:00
# Prepare
rm -rf debian/tmp
mkdir debian/tmp
# Set Version
prepare_version() {
2020-12-04 21:32:17 +00:00
sed -i 's/${VERSION}/'"${DEB_VERSION}.$(date --utc '+%Y%m%d.%H%M')"'/g' "$1/DEBIAN/control"
2020-12-04 21:27:28 +00:00
}
2020-10-16 19:39:04 +00:00
# Package Client DEBs
2020-12-04 21:27:28 +00:00
docker save thebrokenrail/minecraft-pi:client | gzip > debian/tmp/client-image.tar.gz
2020-10-16 19:39:04 +00:00
package_client() {
2020-12-04 21:27:28 +00:00
# Clean
rm -rf "debian/tmp/$1"
# Prepare
rsync -r debian/client/common/ "debian/tmp/$1"
rsync -r "debian/client/$1/" "debian/tmp/$1"
cp debian/tmp/client-image.tar.gz "debian/tmp/$1/usr/share/minecraft-pi/client/image.tar.gz"
prepare_version "debian/tmp/$1"
# Build
dpkg -b "debian/tmp/$1" out/deb
2020-10-16 19:39:04 +00:00
}
package_client virgl
package_client native
# Package Server DEB
2020-12-04 21:27:28 +00:00
docker save thebrokenrail/minecraft-pi:server | gzip > debian/tmp/server-image.tar.gz
package_server() {
# Clean
rm -rf debian/tmp/server
# Prepare
rsync -r debian/server/ debian/tmp/server
cp debian/tmp/server-image.tar.gz debian/tmp/server/usr/share/minecraft-pi/server/image.tar.gz
prepare_version debian/tmp/server
# Build
dpkg -b debian/tmp/server out/deb
}
package_server
# Clean Up
rm -rf debian/tmp
2020-10-03 20:18:53 +00:00
# Export Libraries
mkdir -p out/lib
# Copy Headers
cp -r mods/include out/lib/include
# Copy Shared Library
2020-10-10 23:02:13 +00:00
IMG_ID="$(docker create thebrokenrail/minecraft-pi:client)"
2020-10-15 02:39:30 +00:00
docker cp "${IMG_ID}":/app/minecraft-pi/mods/. ./out/lib/. || :
RET="$?"
2020-10-06 15:08:10 +00:00
docker rm -v "${IMG_ID}"
2020-10-15 02:39:30 +00:00
exit "${RET}"