Presencode/dist/setup-presentation.sh

47 lines
1.8 KiB
Bash
Executable file

#!/usr/sbin/env bash
set -eo pipefail
if [ -n "${VERBOSE}" ]; then set -x; fi
# Print banner
echo " ____ __"
echo "/\\ _\`\\ /\\ \\"
echo "\\ \\ \\L\\ \\_ __ __ ____ __ ___ ___ ___ \\_\\ \\ __"
echo " \\ \\ ,__/\\\`'__\\/'__\`\\ /',__\\ /'__\`\\/' _ \`\\ /'___\\ / __\`\\ /'_\` \\ /'__\`\\"
echo " \\ \\ \\/\\ \\ \\//\\ __//\\__, \`\\/\\ __//\\ \\/\\ \\/\\ \\__//\\ \\L\\ \\/\\ \\L\\ \\/\\ __/"
echo " \\ \\_\\ \\ \\_\\\\ \\____\\/\\____/\\ \\____\\ \\_\\ \\_\\ \\____\\ \\____/\\ \\___,_\\ \\____\\"
echo " \\/_/ \\/_/ \\/____/\\/___/ \\/____/\\/_/\\/_/\\/____/\\/___/ \\/__,_ /\\/____/"
# Initialize
echo ":: Initializing"
## Environment variables
if [ -z "${REPOSITORY_SERVER}" ]; then
export "REPOSITORY_SERVER=git.staropensource.de"
fi
if [ -z "${REPOSITORY_OWNER}" ]; then
export "REPOSITORY_OWNER=JeremyStarTM"
fi
if [ -z "${REPOSITORY_NAME}" ]; then
export "REPOSITORY_NAME=Presencode"
fi
## Dependency checks
if ! which git &> /dev/null; then
echo ":: Error: git is not installed in \$PATH."
exit 2
fi
if ! which godot &> /dev/null; then
if ! which flatpak &> /dev/null; then
echo ":: Error: godot is not installed in \$PATH and could not be installed using flatpak."
exit 2
else
if ! flatpak install flathub org.godotengine.Godot --user --app --assumeyes --noninteractive; then
echo ":: Error: godot is not installed in \$PATH and could not be installed using flatpak."
exit 2
fi
fi
fi
# Download source code
echo ":: Downloading source code"
if ! git clone "https://${REPOSITORY_SERVER}/${REPOSITORY_OWNER}/${REPOSITORY_NAME}.git"; then
echo ":: Error: Could not download source code."
exit 3
fi
# Update project files
echo "Updating project files"