From 8b617017076b1d99efc5adecca7177b8d025c325 Mon Sep 17 00:00:00 2001 From: TheBrokenRail Date: Sat, 26 Sep 2020 20:48:46 -0400 Subject: [PATCH] Build DEB --- .gitignore | 1 + Dockerfile | 8 ++++---- Jenkinsfile | 12 +++++++++++- {scripts => build}/build-libpng12.sh | 0 {scripts => build}/build-mods.sh | 0 {scripts => build}/download-minecraft-pi.sh | 0 debian/DEBIAN/control | 7 +++++++ debian/DEBIAN/postinst | 5 +++++ {data => debian}/usr/bin/minecraft-pi | 0 .../usr/share/applications/minecraft-pi.desktop | 0 .../usr/share/minecraft-pi/docker-compose.yml | 0 .../usr/share/pixmaps/minecraft-pi.png | Bin install.sh | 7 ------- build.sh => scripts/build.sh | 0 scripts/package.sh | 16 ++++++++++++++++ 15 files changed, 44 insertions(+), 12 deletions(-) rename {scripts => build}/build-libpng12.sh (100%) rename {scripts => build}/build-mods.sh (100%) rename {scripts => build}/download-minecraft-pi.sh (100%) create mode 100644 debian/DEBIAN/control create mode 100755 debian/DEBIAN/postinst rename {data => debian}/usr/bin/minecraft-pi (100%) rename {data => debian}/usr/share/applications/minecraft-pi.desktop (100%) rename {data => debian}/usr/share/minecraft-pi/docker-compose.yml (100%) rename {data => debian}/usr/share/pixmaps/minecraft-pi.png (100%) delete mode 100755 install.sh rename build.sh => scripts/build.sh (100%) create mode 100755 scripts/package.sh diff --git a/.gitignore b/.gitignore index 0055243e..8895e24b 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ /libpng /core/build /mods/build +/out diff --git a/Dockerfile b/Dockerfile index 5660af89..1c84b265 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,12 +14,12 @@ ADD . /app WORKDIR /app -RUN ./scripts/download-minecraft-pi.sh +RUN ./build/download-minecraft-pi.sh -RUN ./scripts/build-mods.sh +RUN ./build/build-mods.sh -RUN ./scripts/build-libpng12.sh +RUN ./build/build-libpng12.sh -WORKDIR /app/minecraft-pi +WORKDIR ./minecraft-pi ENTRYPOINT ./launcher diff --git a/Jenkinsfile b/Jenkinsfile index 1973e699..ee3c213f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -13,7 +13,7 @@ pipeline { } stage('Build') { steps { - sh './build.sh' + sh './scripts/build.sh' } } stage('Publish') { @@ -24,5 +24,15 @@ pipeline { sh 'docker push thebrokenrail/minecraft-pi' } } + stage('Package') { + steps { + sh './scripts/package.sh' + } + post { + success { + archiveArtifacts artifacts: 'out/*', fingerprint: true + } + } + } } } diff --git a/scripts/build-libpng12.sh b/build/build-libpng12.sh similarity index 100% rename from scripts/build-libpng12.sh rename to build/build-libpng12.sh diff --git a/scripts/build-mods.sh b/build/build-mods.sh similarity index 100% rename from scripts/build-mods.sh rename to build/build-mods.sh diff --git a/scripts/download-minecraft-pi.sh b/build/download-minecraft-pi.sh similarity index 100% rename from scripts/download-minecraft-pi.sh rename to build/download-minecraft-pi.sh diff --git a/debian/DEBIAN/control b/debian/DEBIAN/control new file mode 100644 index 00000000..4fca1360 --- /dev/null +++ b/debian/DEBIAN/control @@ -0,0 +1,7 @@ +Package: minecraft-pi +Version: 1.0.0 +Maintainer: TheBrokenRail +Description: Fun with Blocks +Homepage: https://www.minecraft.net/en-us/edition/pi +Architecture: amd64 +Depends: docker-io, virgl-server diff --git a/debian/DEBIAN/postinst b/debian/DEBIAN/postinst new file mode 100755 index 00000000..a030b98e --- /dev/null +++ b/debian/DEBIAN/postinst @@ -0,0 +1,5 @@ +#!/bin/sh + +set -e + +docker run --rm --privileged multiarch/qemu-user-static --reset -p yes diff --git a/data/usr/bin/minecraft-pi b/debian/usr/bin/minecraft-pi similarity index 100% rename from data/usr/bin/minecraft-pi rename to debian/usr/bin/minecraft-pi diff --git a/data/usr/share/applications/minecraft-pi.desktop b/debian/usr/share/applications/minecraft-pi.desktop similarity index 100% rename from data/usr/share/applications/minecraft-pi.desktop rename to debian/usr/share/applications/minecraft-pi.desktop diff --git a/data/usr/share/minecraft-pi/docker-compose.yml b/debian/usr/share/minecraft-pi/docker-compose.yml similarity index 100% rename from data/usr/share/minecraft-pi/docker-compose.yml rename to debian/usr/share/minecraft-pi/docker-compose.yml diff --git a/data/usr/share/pixmaps/minecraft-pi.png b/debian/usr/share/pixmaps/minecraft-pi.png similarity index 100% rename from data/usr/share/pixmaps/minecraft-pi.png rename to debian/usr/share/pixmaps/minecraft-pi.png diff --git a/install.sh b/install.sh deleted file mode 100755 index db3ac529..00000000 --- a/install.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -set -e - -sudo adduser "$(whoami)" docker || : - -sudo cp -r data/. / diff --git a/build.sh b/scripts/build.sh similarity index 100% rename from build.sh rename to scripts/build.sh diff --git a/scripts/package.sh b/scripts/package.sh new file mode 100755 index 00000000..e3a365b1 --- /dev/null +++ b/scripts/package.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +set -e + +# Docker Messes With SetGID +chmod -R g-s debian + +# Allow minecraft-pi Script To Use Docker +chmod u+s debian/usr/bin/minecraft-pi + +# Clean out Directory +rm -rf out +mkdir out + +# Generate DEB +dpkg -b debian out