love-linux-builder/snap/build.sh

38 lines
830 B
Bash
Raw Normal View History

2016-12-02 15:31:44 +00:00
#!/bin/bash
set -eo >/dev/null
2017-09-06 16:01:36 +00:00
ARCH="$(uname -m)"
2016-12-02 15:31:44 +00:00
if [[ $# -lt 1 ]]; then
echo "Usage: $0 <version>"
exit 0
fi
VERSION="$1"
2017-09-06 16:01:36 +00:00
if ! test -f ../tarball/love-${VERSION}-${ARCH}.tar.gz; then
2016-12-02 15:31:44 +00:00
echo "No tarball found for $VERSION"
exit 1
fi
# Extract the tarball build into a folder
rm -rf love-prepared
mkdir love-prepared
2017-09-06 16:01:36 +00:00
tar xf ../tarball/love-${VERSION}-${ARCH}.tar.gz -C love-prepared --strip-components=1
2016-12-02 15:31:44 +00:00
cd love-prepared
# Now add snap stuff
# First, our icon and desktop file
mkdir -p meta/gui
mv love.svg meta/gui/icon.svg
sed -e 's/%BINARY%/love/' -e '/%ICON%/d' love.desktop.in > meta/gui/love.desktop
2016-12-02 15:31:44 +00:00
rm love.desktop.in
# Now the yaml and launcher
sed -e "s/%VERSION%/$VERSION/" ../snap.yaml > meta/snap.yaml
cp ../command-love.wrapper .
# Finally, build it!
2017-09-06 16:01:36 +00:00
mksquashfs . ../love_${VERSION}_${ARCH}.snap -noappend