-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkdegames
80 lines (68 loc) · 3.19 KB
/
kdegames
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/sh
APP=kdegames
mkdir tmp;
cd tmp;
# DOWNLOADING THE DEPENDENCIES
wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-i686.AppImage -O appimagetool
wget https://github.com/ivan-hc/pkg2appimage-32bit/releases/download/continuous/pkg2appimage-i386.AppImage -O pkg2appimage # 32 BIT ONLY (uncomment to enable)
chmod a+x ./appimagetool ./pkg2appimage
# CREATING THE APPIMAGE: APPDIR FROM A RECIPE...
VERSION=$(echo $(wget -q https://packages.debian.org/stable/i386/kdegames/download -O - | grep ".deb" | head -1 | grep -o -P '(?<=kdegames_).*(?=_i386)'))
echo "app: kdegames
binpatch: true
ingredients:
dist: stable
sources:
- deb http://deb.debian.org/debian/ stable main contrib non-free
- deb http://deb.debian.org/debian-security/ stable-security main contrib non-free
- deb http://deb.debian.org/debian stable-updates main contrib non-free
- deb http://deb.debian.org/debian stable-backports main contrib non-free
packages:
- kdegames
- kde-games-core
- qml-module-qtquick2
- qml-module-org-kde-games-core" >> recipe.yml;
ARCH=i386 ./pkg2appimage ./recipe.yml;
# ...REPLACING THE EXISTING APPRUN WITH A CUSTOM ONE...
rm -R -f ./$APP/$APP.AppDir/AppRun
cat >> ./$APP/$APP.AppDir/AppRun << 'EOF'
#!/bin/sh
HERE="$(dirname "$(readlink -f "${0}")")"
export UNION_PRELOAD="${HERE}"
export PATH="${HERE}"/usr/bin/:"${HERE}"/usr/sbin/:"${HERE}"/usr/games/:"${HERE}"/bin/:"${HERE}"/opt/kdegames/:"${HERE}"/sbin/:"${PATH}"
export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/:/usr/lib/i386-linux-gnu/:"${HERE}"/usr/lib/:"${HERE}"/usr/lib/i386-linux-gnu/:"${HERE}"/usr/lib/x86_64-linux-gnu/:"${HERE}"/lib/:"${HERE}"/lib/i386-linux-gnu/:"${HERE}"/lib/x86_64-linux-gnu/:"${LD_LIBRARY_PATH}"
export XDG_DATA_DIRS="${HERE}"/usr/share/:"${XDG_DATA_DIRS}"
export GSETTINGS_SCHEMA_DIR="${HERE}"/usr/share/glib-2.0/schemas/:"${GSETTINGS_SCHEMA_DIR}"
export QT_PLUGIN_PATH="${HERE}"/usr/lib/qt4/plugins/:"${HERE}"/usr/lib/i386-linux-gnu/qt4/plugins/:"${HERE}"/usr/lib/x86_64-linux-gnu/qt4/plugins/:"${HERE}"/usr/lib32/qt4/plugins/:"${HERE}"/usr/lib64/qt4/plugins/:"${HERE}"/usr/lib/qt5/plugins/:"${HERE}"/usr/lib/i386-linux-gnu/qt5/plugins/:"${HERE}"/usr/lib/x86_64-linux-gnu/qt5/plugins/:"${HERE}"/usr/lib32/qt5/plugins/:"${HERE}"/usr/lib64/qt5/plugins/:"${QT_PLUGIN_PATH}"
case $1 in
-h|--help) echo "
AVAILABLE KDE GAMES:
$(ls "${HERE}"/usr/games)
";;
*) if test -f "${HERE}"/usr/games/$1; then
EXEC=$(grep -e '^Exec=.*' "${HERE}"/usr/share/applications/org.kde.$1.desktop | head -n 1 | cut -d "=" -f 2- | sed -e 's|%.||g')
exec ${EXEC} "$@" 2>/dev/null
exit
else
echo "
AVAILABLE KDE GAMES:
$(ls "${HERE}"/usr/games)
"
fi;;
esac
EOF
sed -i 's/x86_64/i386/g' ./$APP/$APP.AppDir/AppRun
sed -i 's/64/x32/g' ./$APP/$APP.AppDir/AppRun
chmod a+x ./$APP/$APP.AppDir/AppRun
# ...ADD A LAUNCHER AND AN ICON TO THE APPDIR...
cp ./$APP/$APP.AppDir/usr/share/icons/hicolor/256x256/apps/kpat* ./$APP/$APP.AppDir/ 2>/dev/null
echo "[Desktop Entry]
Name=kdegames
Exec=AppRun
Icon=kpat
Type=Application
Categories=Game;" >> ./$APP/$APP.AppDir/$APP.desktop
# ...EXPORT THE APPDIR TO AN APPIMAGE!
ARCH=i386 ./appimagetool -n ./$APP/$APP.AppDir
cd ..
mv ./tmp/*.AppImage ./Kdegames_"$VERSION"-i386.AppImage