PortableLinuxGames/buildAppImage

48 lines
1.1 KiB
Plaintext
Raw Normal View History

2013-02-18 15:24:33 -08:00
#!/bin/bash
2013-04-14 05:05:22 -07:00
# Author : Ismael Barros² <ismael@barros2.org>
# License : BSD http://en.wikipedia.org/wiki/BSD_license
2013-02-18 15:24:33 -08:00
2021-01-10 14:44:59 -08:00
InputDir="${1:-$PWD}"
OutputDir="$InputDir/.."
2013-12-25 02:23:28 -08:00
arch="$(uname -m)"
2014-01-16 14:17:48 -08:00
for i in "$@"; do
case "$i" in
-o=*)
OutputDir=${i#*=}
shift
;;
2021-01-10 14:44:59 -08:00
-m=*)
arch=${i#*=}
shift
;;
2014-01-16 14:17:48 -08:00
esac
done
2021-01-10 14:44:59 -08:00
[ -d "$InputDir" ] || { echo "Directory $InputDir doesn't exist"; exit 1; }
2013-02-18 15:24:33 -08:00
2021-01-10 14:44:59 -08:00
case "$arch" in
i386|i586|i686) arch="i686" ;;
x86_64|amd64) arch="x86_64" ;;
esac
AppImageTool="$(dirname $(readlink -f "$0"))/AppImage/appimagetool-${arch}.AppImage"
[ -f "$AppImageTool" ] || { echo "Could not find $AppImageTool"; exit 1; }
export ARCH="$arch"
DesktopFile=$(ls -1 "$InputDir"/*.desktop | head -n1)
[ -n "$DesktopFile" ] || { echo "No *.desktop file found in $InputDir"; exit 1; }
case "$arch" in
i386|i586|i686) arch="x86" ;;
esac
2013-02-18 15:24:33 -08:00
2021-01-10 14:44:59 -08:00
PackageName="$(egrep Name "$DesktopFile" | head -n1 | cut -d= -f2)"
PackagePath="$(readlink -f "$OutputDir/${PackageName}-${arch}.run")"
2013-02-18 15:24:33 -08:00
2021-01-10 14:44:59 -08:00
rm -if "$PackagePath"
echo "Building $PackagePath..."
2013-02-18 15:24:33 -08:00
2021-01-10 14:44:59 -08:00
"$AppImageTool" --no-appstream "$InputDir" "$PackagePath"