steam-install: robustify

removeproofs
Francesco Minnocci 11 months ago
parent a88174ff4f
commit b4d68ded01
No known key found for this signature in database
GPG Key ID: 76DA3AF9BAED1A32

@ -1,26 +1,38 @@
#!/bin/sh
#!/bin/bash
set -xeo pipefail
# Installs the AppImage for steam
# Variables
APP=Steam-x86_64.AppImage
NAME=steam
URL="https://github.com/ivan-hc/Steam-appimage/releases/download/continuous/Steam-202310201446-x86_64.AppImage"
LOCAL_BIN_DIR=$HOME/.local/bin
DESKTOP_DIR=$HOME/.local/share/applications
mkdir -p $HOME/.local/bin
echo "export PATH=$PATH:$HOME/.local/bin" >> .bashrc
echo "export PATH=$PATH:$HOME/.local/bin" >> .bash_profile
# Ensure local bin directory is in PATH
if [[ ! ":$PATH:" == *":$LOCAL_BIN_DIR:"* ]]; then
echo "export PATH=\$PATH:$LOCAL_BIN_DIR" >> $HOME/.bashrc
echo "export PATH=\$PATH:$LOCAL_BIN_DIR" >> $HOME/.bash_profile
fi
# Install Steam AppImage
cd /tmp
curl -LO $URL
chmod +x $APP
./$APP --appimage-extract
mv squashfs-root $HOME/$NAME
cd $HOME/$NAME
ln -sf $(realpath AppRun) $HOME/.local/bin/$NAME
desktop-file-install --dir="$HOME/.local/share/applications" $NAME.desktop
sed -i "s|Exec=$NAME|Exec=$HOME/.local/bin/$NAME|g" $HOME/.local/share/applications/$NAME.desktop
gio set "$HOME/.local/share/applications/$NAME.desktop" "metadata::trusted" true
# Create symbolic link to AppRun
ln -sf $(realpath $HOME/$NAME/AppRun) $LOCAL_BIN_DIR/$NAME
# Install desktop entry
desktop-file-install --dir="$DESKTOP_DIR" $HOME/$NAME/$NAME.desktop
# Update desktop entry
sed -i "s|Exec=$NAME|Exec=$LOCAL_BIN_DIR/$NAME|g" $DESKTOP_DIR/$NAME.desktop
# Mark desktop entry as trusted
gio set "$DESKTOP_DIR/$NAME.desktop" "metadata::trusted" true
# Clean up
rm -rf /tmp/$APP

Loading…
Cancel
Save