Add HeroicBashLauncher for adding games to steam

This commit is contained in:
Josh.5
2022-01-16 07:20:28 +13:00
parent 090c274a55
commit 8fc06d9621

View File

@@ -5,7 +5,7 @@
# File Created: Thursday, 1st January 1970 12:00:00 pm
# Author: Console and webGui login account (jsunnex@gmail.com)
# -----
# Last Modified: Sunday, 16th January 2022 6:14:06 am
# Last Modified: Sunday, 16th January 2022 7:10:49 am
# Modified By: Console and webGui login account (jsunnex@gmail.com)
###
@@ -13,6 +13,12 @@ pkg=heroic
script_path=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd );
script_name=$( basename "${BASH_SOURCE[0]}" )
github_get_all_release() {
REPO="${1}";
curl --silent "https://api.github.com/repos/${REPO}/releases" \
| grep '"tag_name":' \
| sed -E 's/.*"([^"]+)".*/\1/';
}
install() {
if ! dpkg --get-selections | grep -q "^$pkg[[:space:]]*install$" >/dev/null; then
@@ -23,6 +29,44 @@ install() {
apt-get install -y heroic
fi
if ! dpkg --get-selections | grep -q "^zenity[[:space:]]*install$" >/dev/null; then
# Pre-install deps
apt-get update
apt-get install -y zenity
fi
if [[ ! -d "/home/${USER}/HeroicBashLauncher" ]]; then
# Download HeroicBashLauncher
latest_release=$(github_get_all_release redromnon/HeroicBashLauncher | head -n1)
download_url="https://github.com/redromnon/HeroicBashLauncher/releases/download/${latest_release}/HeroicBashLauncher_${latest_release}.zip"
wget -O "/tmp/HeroicBashLauncher-${latest_release}.zip" "${download_url}"
# Extract HeroicBashLauncher
su ${USER} -c "cd /home/${USER} && unzip -o /tmp/HeroicBashLauncher-${latest_release}.zip"
# Setup as user
chmod +x /home/${USER}/HeroicBashLauncher/setup.sh
sed -i 's|^#!.*\/bash$|#!/usr/bin/env bash|' /home/${USER}/HeroicBashLauncher/setup.sh
fi
# Run script on each start
su ${USER} -c "cd /home/${USER}/HeroicBashLauncher && bash ./setup.sh"
# Add launcher to reload
cat << EOF > /usr/share/applications/heroicbashlauncher.desktop
[Desktop Entry]
Name=Heroic Games Reload Bash Launcher Scripts
Comment=Manually reload the HeroicBashLauncher scripts
GenericName=Heroic Games Reload Bahs Launcher Scripts
X-GNOME-FullName=Heroic Games Reload Bahs Launcher Scripts
Exec=/home/${USER}/HeroicBashLauncher/setup.sh %u
Path=/home/${USER}/HeroicBashLauncher
Terminal=true
X-MultipleArgs=false
Type=Application
Icon=heroic
Categories=Game;
EOF
# Remove installer shortcut
rm -f /usr/share/applications/install.heroic.desktop
}