-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
65 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,88 @@ | ||
#!/bin/sh | ||
|
||
set -u | ||
APP=extremetuxracer | ||
|
||
mkdir tmp; | ||
cd tmp; | ||
# CREATE A TEMPORARY DIRECTORY | ||
mkdir -p tmp && cd tmp || exit 1 | ||
|
||
# DOWNLOADING THE DEPENDENCIES | ||
wget -q https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage -O appimagetool | ||
wget https://raw.githubusercontent.com/ivan-hc/AM-application-manager/main/tools/pkg2appimage | ||
if test -f ./appimagetool; then | ||
echo " appimagetool already exists" 1> /dev/null | ||
else | ||
echo " Downloading appimagetool..." | ||
wget -q https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage -O appimagetool | ||
fi | ||
if test -f ./pkg2appimage; then | ||
echo " pkg2appimage already exists" 1> /dev/null | ||
else | ||
echo " Downloading pkg2appimage..." | ||
wget -q https://raw.githubusercontent.com/ivan-hc/AM-application-manager/main/tools/pkg2appimage | ||
fi | ||
chmod a+x ./appimagetool ./pkg2appimage | ||
rm -f ./recipe.yml | ||
|
||
# CREATING THE APPIMAGE | ||
echo "app: extremetuxracer | ||
# CREATING THE HEAD OF THE RECIPE | ||
echo "app: $APP | ||
binpatch: true | ||
ingredients: | ||
dist: stable | ||
#script: | ||
#- COMMAND | ||
sources: | ||
- deb http://ftp.debian.org/debian/ stable main contrib non-free | ||
- deb http://security.debian.org/debian-security/ stable-security main contrib non-free | ||
- deb http://ftp.debian.org/debian/ stable-updates main contrib non-free | ||
packages: | ||
- extremetuxracer" >> recipe.yml; | ||
- $APP" > recipe.yml | ||
|
||
|
||
# DOWNLOAD ALL THE NEEDED PACKAGES AND COMPILE THE APPDIR | ||
./pkg2appimage ./recipe.yml | ||
|
||
./pkg2appimage ./recipe.yml; | ||
# VERSION | ||
MAIN_DEB=$(find . -type f -name "$APP\_*.deb" | head -1 | sed 's:.*/::') | ||
if test -f ./"$APP"/"$MAIN_DEB"; then | ||
ar x ./"$APP"/"$MAIN_DEB" && tar xf ./control.tar.* && rm -f ./control.tar.* ./data.tar.* || exit 1 | ||
VERSION=$(grep Version 0<control | cut -c 10-) | ||
else | ||
VERSION="test" | ||
fi | ||
|
||
cp ./$APP/$APP.AppDir/usr/share/applications/* ./$APP/$APP.AppDir/ | ||
cp ./$APP/$APP.AppDir/usr/share/pixmaps/* ./$APP/$APP.AppDir/ | ||
# LIBUNIONPRELOAD | ||
rm -f ./"$APP"/"$APP".AppDir/libunionpreload.so | ||
#wget -q https://github.com/project-portable/libunionpreload/releases/download/amd64/libunionpreload.so -O ./"$APP"/"$APP".AppDir/libunionpreload.so && chmod a+x ./"$APP"/"$APP".AppDir/libunionpreload.so || exit 1 | ||
|
||
# UNCOMMENT THE FOLLOWING LINE TO REMOVE FILES IN "METAINFO" IN CASE OF ERRORS WITH "APPSTREAM" | ||
rm -R -f ./$APP/$APP.AppDir/usr/share/metainfo/* | ||
# COMPILE SCHEMAS | ||
glib-compile-schemas ./"$APP"/"$APP".AppDir/usr/share/glib-2.0/schemas/ || echo "No ./usr/share/glib-2.0/schemas/" | ||
|
||
ARCH=x86_64 ./appimagetool --comp zstd --mksquashfs-opt -Xcompression-level --mksquashfs-opt 20 ./$APP/$APP.AppDir; | ||
# IMPORT THE LAUNCHER AND THE ICON TO THE APPDIR IF THEY NOT EXIST | ||
if test -f ./"$APP"/"$APP".AppDir/*.desktop; then | ||
echo "The desktop file exists" | ||
else | ||
echo "Trying to get the .desktop file" | ||
cp "./$APP/$APP.AppDir/usr/share/applications/*$(find . -type f -name "*$APP*.desktop" | head -1 | sed 's:.*/::')*" ./"$APP"/"$APP".AppDir/ 2>/dev/null | ||
fi | ||
|
||
cd ..; | ||
mv ./tmp/*.AppImage ./; | ||
chmod a+x ./$APP | ||
ICONNAME=$(cat ./"$APP"/"$APP".AppDir/*desktop | grep "Icon=" | head -1 | cut -c 6-) | ||
cp ./"$APP"/"$APP".AppDir/usr/share/icons/hicolor/22x22/apps/*"$ICONNAME"* ./"$APP"/"$APP".AppDir/ 2>/dev/null | ||
cp ./"$APP"/"$APP".AppDir/usr/share/icons/hicolor/24x24/apps/*"$ICONNAME"* ./"$APP"/"$APP".AppDir/ 2>/dev/null | ||
cp ./"$APP"/"$APP".AppDir/usr/share/icons/hicolor/32x32/apps/*"$ICONNAME"* ./"$APP"/"$APP".AppDir/ 2>/dev/null | ||
cp ./"$APP"/"$APP".AppDir/usr/share/icons/hicolor/48x48/apps/*"$ICONNAME"* ./"$APP"/"$APP".AppDir/ 2>/dev/null | ||
cp ./"$APP"/"$APP".AppDir/usr/share/icons/hicolor/64x64/apps/*"$ICONNAME"* ./"$APP"/"$APP".AppDir/ 2>/dev/null | ||
cp ./"$APP"/"$APP".AppDir/usr/share/icons/hicolor/128x128/apps/*"$ICONNAME"* ./"$APP"/"$APP".AppDir/ 2>/dev/null | ||
cp ./"$APP"/"$APP".AppDir/usr/share/icons/hicolor/256x256/apps/*"$ICONNAME"* ./"$APP"/"$APP".AppDir/ 2>/dev/null | ||
cp ./"$APP"/"$APP".AppDir/usr/share/icons/hicolor/512x512/apps/*"$ICONNAME"* ./"$APP"/"$APP".AppDir/ 2>/dev/null | ||
cp ./"$APP"/"$APP".AppDir/usr/share/icons/hicolor/scalable/apps/*"$ICONNAME"* ./"$APP"/"$APP".AppDir/ 2>/dev/null | ||
cp ./"$APP"/"$APP".AppDir/usr/share/applications/*"$ICONNAME"* ./"$APP"/"$APP".AppDir/ 2>/dev/null | ||
|
||
rm -R -f ./tmp | ||
# EXPORT THE APP TO AN APPIMAGE | ||
printf '#!/bin/sh\nexit 0' > ./desktop-file-validate # hack due to https://github.com/AppImage/appimagetool/pull/47 | ||
chmod a+x ./desktop-file-validate | ||
PATH="$PATH:$PWD" ARCH=x86_64 ./appimagetool -n ./"$APP"/"$APP".AppDir | ||
if ! test -f ./*.AppImage; then | ||
echo "No AppImage available."; exit 1 | ||
fi | ||
cd .. && mv ./tmp/*.AppImage ./Extreme_Tux_Racer-"$VERSION"-x86_64.AppImage && chmod a+x ./*.AppImage || exit 1 |