70 lines
2 KiB
Text
70 lines
2 KiB
Text
|
#!/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/itchio/itch-setup/tags | grep name | head -n1 | grep -o "v[0-9.]*" | tr -d v)}
|
||
|
BUILD=${BUILD:-1}
|
||
|
TAG=${TAG:-gwh}
|
||
|
|
||
|
rm -rf "$PKG"
|
||
|
mkdir -p "$PKG"/usr/{bin,libexec/"$PRGNAM"} "$OUTPUT"
|
||
|
|
||
|
wget -c "https://broth.itch.ovh/itch-setup/linux-amd64/$VERSION/unpacked/default" -O "$PKG"/usr/libexec/"$PRGNAM"/"$PRGNAM-$VERSION"
|
||
|
chmod +x "$PKG"/usr/libexec/"$PRGNAM"/"$PRGNAM-$VERSION"
|
||
|
|
||
|
cat <<EOF > "$PKG"/usr/bin/itch
|
||
|
#!/bin/bash
|
||
|
|
||
|
set -eu
|
||
|
|
||
|
/usr/libexec/"$PRGNAM"/"$PRGNAM-$VERSION" --prefer-launch -- "$@"
|
||
|
EOF
|
||
|
chmod +x "$PKG"/usr/bin/itch
|
||
|
|
||
|
mkdir -p "$PKG"/usr/share/applications/
|
||
|
cat <<EOF > "$PKG"/usr/share/applications/itch.desktop
|
||
|
[Desktop Entry]
|
||
|
Type=Application
|
||
|
Name=itch
|
||
|
TryExec=itch
|
||
|
Exec=itch %U
|
||
|
Icon=itch
|
||
|
Terminal=false
|
||
|
Categories=Game;
|
||
|
MimeType=x-scheme-handler/itchio;x-scheme-handler/itch;
|
||
|
X-GNOME-Autostart-enabled=true
|
||
|
Comment=Install and play itch.io games easily
|
||
|
Name[it_IT]=itch.desktop
|
||
|
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 (An installer for the itch.io desktop app)
|
||
|
$PRGNAM:
|
||
|
$PRGNAM: This is the install and self-update helper for the itch.io app
|
||
|
$PRGNAM:
|
||
|
$PRGNAM:
|
||
|
$PRGNAM:
|
||
|
$PRGNAM:
|
||
|
$PRGNAM:
|
||
|
$PRGNAM:
|
||
|
$PRGNAM: https://itch.io/app
|
||
|
$PRGNAM:
|
||
|
EOF
|
||
|
|
||
|
cd "$PKG" || exit 1
|
||
|
/sbin/makepkg --linkadd y --chown n --prepend "$OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.txz"
|