Skip to content

Commit

Permalink
Improve pack script
Browse files Browse the repository at this point in the history
  • Loading branch information
SmallJoker committed Feb 16, 2024
1 parent 59536b2 commit f2d19c9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 15 deletions.
35 changes: 21 additions & 14 deletions misc/pack.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,25 +1,31 @@
#!/usr/bin/env sh
#!/usr/bin/env bash
# To be executed in a separate directory for packing

# change me if needed
GAMEDIR="$PWD/OpenEdits"
set -e
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
PROJ="OpenEdits"

# fake install location from CMake
GAMEDIR="$SCRIPT_DIR/../../packages/$PROJ"

# ----------------

set -e
binary="$PROJ"
[ ! -e "$GAMEDIR/$binary" ] && binary="$binary.exe"
filestr=$(file "$GAMEDIR/$binary")

ostype=""
binary="OpenEdits"
case "$OSTYPE" in
darwin*) ostype="macOS" ;;
linux*) ostype="Linux" ;;
bsd*) ostype="BSD" ;;
msys*) ostype="Windows" ;;
cygwin*) ostype="Windows" ;;
arch=""
case "$filestr" in
*"MS Windows"*) ostype="Windows" ;;
*"Linux"*) ostype="Linux" ;;
esac
case "$filestr" in
*" x86-64"*) arch="x86_64" ;;
esac

[ -z "$ostype" ] && echo "Unhandled platform." && exit 1
[ "$ostype" = "Windows" ] && binary="OpenEdits.exe"
[ -z "$arch" ] && echo "Unhandled architecture." && exit 1

echo "--- Removing testing files"
rm -vf "$GAMEDIR"/*.sqlite*
Expand All @@ -28,11 +34,12 @@ rm -vrf "$GAMEDIR/worlds"

# zipping
version=$(grep -Eoa "v[0-9]+\.[0-9]+\.[0-9]+[^ ]*" "$GAMEDIR/$binary")
echo "--- Found version: $version"
#version=$(strings "$GAMEDIR/$binary" | grep -Eo "v[0-9]+\.[0-9]+\.[0-9]+[^ ]*")
zipfile="OpenEdits-$version-$ostype-x86_64.7z"
zipfile="$GAMEDIR/../$PROJ-$version-$ostype-x86_64.7z"

rm -f "$zipfile" # old archive
7z a -t7z -scrcSHA1 "$zipfile" "$GAMEDIR"
7z a -t7z -scrcSHA256 "$zipfile" "$GAMEDIR"

echo ""
echo "--- sha256 checksum"
Expand Down
2 changes: 1 addition & 1 deletion src/version.cpp.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

const char *VERSION_STRING = "OpenEdits v1.1.0-${GIT_SHA1} (${CMAKE_BUILD_TYPE})";
const char *VERSION_STRING = "OpenEdits v1.2.0-${GIT_SHA1} (${CMAKE_BUILD_TYPE})";

0 comments on commit f2d19c9

Please sign in to comment.