Skip to content

Instantly share code, notes, and snippets.

@josefnpat
Created July 10, 2014 18:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save josefnpat/b16d5e4e2a510ddcf99f to your computer and use it in GitHub Desktop.
Save josefnpat/b16d5e4e2a510ddcf99f to your computer and use it in GitHub Desktop.
Starfire Lords: Genesis run script for LÖVE
#!/bin/sh
# Copyright (c) 2014 Josef Patorpsty
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damages
# arising from the use of this software.
#
# Permission is granted to anyone to use this software for any purpose,
# including commercial applications, and to alter it and redistribute it
# freely, subject to the following restrictions:
#
# 1. The origin of this software must not be misrepresented; you must not
# claim that you wrote the original software. If you use this software
# in a product, an acknowledgment in the product documentation would be
# appreciated but is not required.
#
# 2. Altered source versions must be plainly marked as such, and must not be
# misrepresented as being the original software.
#
# 3. This notice may not be removed or altered from any source
# distribution.
# CONFIG
GAMENAME="Starfire Lords: Genesis"
REQVER="LOVE 0.9.1 (Baby Inspector)" # Copy from `love --version`
TARGET="slg09x_*.love" # The love file you want to run.
# STOP CONFIG'ING
CURVER=`love --version`
if [ "$CURVER" = "" ]; then
CURVER="Not Installed."
fi
if [ "$CURVER" = "$REQVER" ]; then
love $TARGET
else
if type "zenity" > /dev/null; then # CHECK FOR ZENITY
TEXT="<b>$GAMENAME</b> requires LÖVE to play.\n\nPlease install the correct version of LÖVE:\n\nRequired:\n\n\t$REQVER\n\nCurrent:\n\n\t$CURVER\n\nFor more information getting LÖVE, please visit:\n\n\thttps://love2d.org/\n\n For more information on building LÖVE from source, please visit:\n\n\thttps://www.love2d.org/wiki/Building_LOVE\n\nYou may attempt to run this game with the current version of LÖVE,\n but be warned that it is not guaranteed to run."
if ! zenity --title="$GAMENAME ― Run Script" --question --no-wrap --text="$TEXT" --ok-label="Cancel" --cancel-label="Run Anyway"; then
love $TARGET
fi
else # BAILING OUT, GOOD LUCK.
echo "$GAMENAME requires LÖVE to play."
echo "Required: $REQVER"
echo "Current: $CURVER"
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment