From ce78a64e158559902f835a643f5d95af5c664651 Mon Sep 17 00:00:00 2001 From: "Alex Xu (Hello71)" Date: Wed, 13 Apr 2022 11:57:09 -0400 Subject: Initial commit --- runescape-launcher-launcher | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 runescape-launcher-launcher (limited to 'runescape-launcher-launcher') diff --git a/runescape-launcher-launcher b/runescape-launcher-launcher new file mode 100755 index 0000000..369b992 --- /dev/null +++ b/runescape-launcher-launcher @@ -0,0 +1,42 @@ +#!/bin/sh + +set -e +xdg_data_home=${XDG_DATA_HOME:-$HOME/.local/share} +rll=$xdg_data_home/runescape-launcher-launcher +tmpdir=$(mktemp -dt runescape-launcher-launcher.XXXXXXXXXX) +trap 'echo "cleaning up temporary directory..." >&2; rm -rf "$tmpdir"' INT TERM QUIT EXIT +if [ -f "$rll/Packages" ]; then + echo "checking for runescape-launcher updates..." +else + echo "downloading runescape-launcher to $rll..." +fi +curl --compressed -sSLo "$tmpdir/Packages" https://content.runescape.com/downloads/ubuntu/dists/trusty/non-free/binary-amd64/Packages +if ! cmp "$rll/Packages" "$tmpdir/Packages" 2>/dev/null; then + ver=$(awk '$1=="Version:"{print $2}' "$tmpdir/Packages") + if [ -f "$rll/Packages" ]; then + echo "updating runescape-launcher..." >&2 + fi + curl --compressed -sSLo "$tmpdir/runescape-launcher_${ver}_amd64.deb" https://content.runescape.com/downloads/ubuntu/pool/non-free/r/runescape-launcher/runescape-launcher_${ver}_amd64.deb + sha256=$(awk '$1=="SHA256:"{print $2}' "$tmpdir/Packages") + echo "$sha256 *$tmpdir/runescape-launcher_${ver}_amd64.deb" | sha256sum -c + if bsdtar=$(command -v bsdtar 2>/dev/null); then + "$bsdtar" -C "$tmpdir" -xf "$tmpdir/runescape-launcher_${ver}_amd64.deb" data.tar.xz + elif ar=$(command -v ar 2>/dev/null); then + "$ar" x --output "$tmpdir" "$tmpdir/runescape-launcher_${ver}_amd64.deb" data.tar.xz + else + echo "bsdtar or ar must be installed to extract runescape-launcher" >&2 + exit 1 + fi + tar -C "$tmpdir" -xf "$tmpdir/data.tar.xz" ./usr/bin/runescape-launcher ./usr/share/games/runescape-launcher/runescape + sed -e 's#/usr/share/games/runescape-launcher/#${0%/*}/#' "$tmpdir/usr/bin/runescape-launcher" > "$tmpdir/runescape-launcher" + cat + install -Dm644 "$tmpdir/Packages" "$rll/Packages" + install -m755 "$tmpdir/runescape-launcher" "$tmpdir/usr/share/games/runescape-launcher/runescape" "$rll/" +else + echo "no updates available for runescape-launcher." >&2 +fi +trap '' INT TERM QUIT EXIT +rm -rf "$tmpdir" +echo "starting runescape-launcher..." >&2 +set -x +exec "$rll/runescape-launcher" "$@" -- cgit v1.2.3-70-g09d2