diff options
author | Alex Xu (Hello71) <alex_y_xu@yahoo.ca> | 2022-04-13 11:57:09 -0400 |
---|---|---|
committer | Alex Xu (Hello71) <alex_y_xu@yahoo.ca> | 2022-04-13 11:57:09 -0400 |
commit | ce78a64e158559902f835a643f5d95af5c664651 (patch) | |
tree | 7105bb1bd749def7df7c1356b44c4ae2637ae8c4 /runescape-launcher-launcher | |
download | runescape-launcher-launcher-1.0.tar.xz runescape-launcher-launcher-1.0.zip |
Initial commit1.0
Diffstat (limited to 'runescape-launcher-launcher')
-rwxr-xr-x | runescape-launcher-launcher | 42 |
1 files changed, 42 insertions, 0 deletions
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" "$@" |