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 set -xeo pipefail
# Installs the AppImage for steam # Variables
APP=Steam-x86_64.AppImage APP=Steam-x86_64.AppImage
NAME=steam NAME=steam
URL="https://github.com/ivan-hc/Steam-appimage/releases/download/continuous/Steam-202310201446-x86_64.AppImage" 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 # Ensure local bin directory is in PATH
echo "export PATH=$PATH:$HOME/.local/bin" >> .bashrc if [[ ! ":$PATH:" == *":$LOCAL_BIN_DIR:"* ]]; then
echo "export PATH=$PATH:$HOME/.local/bin" >> .bash_profile 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 cd /tmp
curl -LO $URL curl -LO $URL
chmod +x $APP chmod +x $APP
./$APP --appimage-extract ./$APP --appimage-extract
mv squashfs-root $HOME/$NAME mv squashfs-root $HOME/$NAME
cd $HOME/$NAME # Create symbolic link to AppRun
ln -sf $(realpath AppRun) $HOME/.local/bin/$NAME ln -sf $(realpath $HOME/$NAME/AppRun) $LOCAL_BIN_DIR/$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 # Install desktop entry
gio set "$HOME/.local/share/applications/$NAME.desktop" "metadata::trusted" true 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 rm -rf /tmp/$APP

Loading…
Cancel
Save