forked from RazZziel/PortableLinuxGames
-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildAppImage
executable file
·47 lines (36 loc) · 1.07 KB
/
buildAppImage
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
# Author : Ismael Barros² <[email protected]>
# License : BSD http://en.wikipedia.org/wiki/BSD_license
InputDir="${1:-$PWD}"
OutputDir="$InputDir/.."
arch="$(uname -m)"
for i in "$@"; do
case "$i" in
-o=*)
OutputDir=${i#*=}
shift
;;
-m=*)
arch=${i#*=}
shift
;;
esac
done
[ -d "$InputDir" ] || { echo "Directory $InputDir doesn't exist"; exit 1; }
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
PackageName="$(egrep Name "$DesktopFile" | head -n1 | cut -d= -f2)"
PackagePath="$(readlink -f "$OutputDir/${PackageName}-${arch}.run")"
rm -if "$PackagePath"
echo "Building $PackagePath..."
"$AppImageTool" --no-appstream "$InputDir" "$PackagePath"