slackbuilds/y/HeroicGamesLauncher-bin/SlackBuild

71 lines
2.2 KiB
Text
Raw Permalink Normal View History

2024-04-23 16:14:30 +02:00
#!/bin/bash
CWD=$(pwd)
TMP=${TMP:-/tmp/$TAG}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
PRGNAM=$(basename "$CWD")
ARCH=${ARCH:-$(uname -m | grep -q 64 && echo "x86_64" || echo "i386")}
VERSION=${VERSION:-$(curl -s https://api.github.com/repos/Heroic-Games-Launcher/HeroicGamesLauncher/tags | grep name | head -n1 | grep -o "v[0-9.]*" | tr -d v)}
2024-06-09 22:47:39 +02:00
BUILD=${BUILD:-2}
2024-04-23 16:14:30 +02:00
TAG=${TAG:-gwh}
rm -rf "$PKG"
mkdir -p "$PKG"/usr/bin "$PKG"/opt "$OUTPUT"
cd "$PKG"/opt || exit 1
wget -c "https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher/releases/download/v$VERSION/heroic-$VERSION.tar.xz" -O "heroic-$VERSION.tar.xz"
tar xf "heroic-$VERSION.tar.xz"
rm "heroic-$VERSION.tar.xz"
cat <<EOF > "$PKG"/usr/bin/heroic
#!/bin/bash
set -eu
cd /opt/"heroic-$VERSION"/
./heroic -- "$@"
EOF
chmod +x "$PKG"/usr/bin/heroic
mkdir -p "$PKG"/usr/share/applications/
2024-06-09 22:47:39 +02:00
cat <<EOF > "$PKG"/usr/share/applications/"$PRGNAM".desktop
2024-04-23 16:14:30 +02:00
[Desktop Entry]
Type=Application
Name=$PRGNAM
TryExec=heroic
Exec=heroic %U
Icon=heroic
Terminal=false
Categories=Game;
X-GNOME-Autostart-enabled=true
Comment=A games launcher for GOG, Amazon and Epic Games for Linux, Windows and macOS.
EOF
mkdir -p "$PKG"/install
cat <<EOF > "$PKG"/install/slack-desc
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler----------------------------------------------------|
$PRGNAM: $PRGNAM (A games launcher for GOG, Amazon and Epic Games)
$PRGNAM:
$PRGNAM: Heroic is an Open Source Game Launcher for Linux, Windows and macOS.
$PRGNAM: Right now it supports launching games from the Epic Games Store
$PRGNAM: using Legendary, GOG Games using our custom implementation with
$PRGNAM: gogdl and Amazon Games using Nile.
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM: https://heroicgameslauncher.com/
$PRGNAM:
EOF
cd "$PKG" || exit 1
/sbin/makepkg --linkadd y --chown n --prepend "$OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.txz"