Skip to content

Commit

Permalink
Take full advantage of deb file customization
Browse files Browse the repository at this point in the history
no need to use /usr/local/bin and force a reboot. Edits steam files in-place and disables the apt repo.
  • Loading branch information
Botspot authored Feb 27, 2024
1 parent 0a3394e commit e7b8e36
Showing 1 changed file with 32 additions and 29 deletions.
61 changes: 32 additions & 29 deletions apps/Steam/install-64
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

version='1.0.0.79'

# install box86
"${DIRECTORY}/manage" install-if-not-installed Box86 || error "Box86 failed to install somehow!"
# install box64
Expand All @@ -26,41 +28,42 @@ if package_installed steamlink ; then
sudo apt purge -y steamlink
fi

#get steam deb and remove terminal dependencies from it, then package it back up
wget -O /tmp/steam_latest.deb "https://repo.steampowered.com/steam/archive/stable/steam_latest.deb"
dpkg-deb -x /tmp/steam_latest.deb /tmp/steam-deb
dpkg-deb -e /tmp/steam_latest.deb /tmp/steam-deb/DEBIAN
rm -f /tmp/steam_latest.deb
sed -i 's/xterm | gnome-terminal | konsole, //g' /tmp/steam-deb/DEBIAN/control
dpkg-deb -b /tmp/steam-deb /tmp/steam_latest.deb
rm -rf /tmp/steam-deb
#get steam deb and unpack it to make a few changes
wget -O /tmp/steam.deb "https://repo.steampowered.com/steam/archive/stable/steam-launcher_${version}_all.deb"
dpkg-deb -x /tmp/steam.deb /tmp/steam-deb
dpkg-deb -e /tmp/steam.deb /tmp/steam-deb/DEBIAN
rm -f /tmp/steam.deb

#fix terminal dependency to include all terminals
sed -i 's/xterm | gnome-terminal | konsole/x-terminal-emulator/g' /tmp/steam-deb/DEBIAN/control

#bump version to ensure a double reinstall will install this customized deb
sed -i 's/\(Version:.*$\)/\1-pi-apps/' /tmp/steam-deb/DEBIAN/control

#remove steam apt repository - prevent it from updating with apt upgrade
rm -rf /tmp/steam-deb/usr/share/keyrings /tmp/steam-deb/etc #remove the folders as there is nothing else in there
rm -f /tmp/steam-deb/DEBIAN/conffiles #this file only mentions the 2 repo files which we just deleted

install_packages /tmp/steam_latest.deb || exit 1
rm -f /tmp/steam_latest.deb
#remove steam command symlink and replace it with runner script
rm -f /tmp/steam-deb/usr/bin/steam

sudo mkdir -p /usr/local/bin /usr/local/share/applications
# if a matching name binary is found in /usr/local/bin it takes priority over /usr/bin
echo '#!/bin/bash
export STEAMOS=1
export STEAM_RUNTIME=1
export DBUS_FATAL_WARNINGS=0
BOX64_LOG=1 BOX86_LOG=1 BOX64_EMULATED_LIBS=libmpg123.so.0 /usr/lib/steam/bin_steam.sh -no-cef-sandbox steam://open/minigameslist "$@"
[ -z "$BOX64_LOG" ] && export BOX64_LOG=1
[ -z "$BOX86_LOG" ] && export BOX86_LOG=1
BOX64_EMULATED_LIBS=libmpg123.so.0 /usr/lib/steam/bin_steam.sh -no-cef-sandbox steam://open/minigameslist "$@"
rm -f ~/Desktop/steam.desktop' > /tmp/steam-deb/usr/bin/steam
chmod +x /tmp/steam-deb/usr/bin/steam

rm -f /home/${USER}/Desktop/steam.desktop' | sudo tee /usr/local/bin/steam || error "Failed to create steam launch script"

# set execution bit
sudo chmod +x /usr/local/bin/steam

# copy official steam.desktop file to /usr/local and edit it
# we can't edit the official steam.desktop file since this will get overwritten on a steam update
# if a matching name .desktop file is found in /usr/local/share/applications it takes priority over /usr/share/applications
sudo cp /usr/share/applications/steam.desktop /usr/local/share/applications/steam.desktop
sudo sed -i 's:Exec=/usr/bin/steam:Exec=/usr/local/bin/steam:' /usr/local/share/applications/steam.desktop
#package it back into a deb
dpkg-deb -b /tmp/steam-deb /tmp/steam.deb || error "Failed to package the steam deb!"
rm -rf /tmp/steam-deb

rm -f $HOME/Desktop/steam.desktop
#install the customized steam-launcher deb
install_packages /tmp/steam.deb || exit 1

if ! echo "$XDG_DATA_DIRS" | grep -q "/usr/local/share" || ! echo "$PATH" | grep -q "/usr/local/bin" ; then
warning "YOU NEED TO REBOOT before starting steam. This is because Steam is the first application on your system to be installed into the /usr/local folder."
else
warning "You should restart your system before trying to launch Steam otherwise errors may occur."
fi
rm -f /tmp/steam.deb $HOME/Desktop/steam.desktop
sudo rm -f /usr/local/bin/steam /usr/local/share/applications/steam.desktop #remove old command wrapper and app-launcher wrappers
sudo rm -f /etc/apt/sources.list.d/steam-stable.list /etc/apt/sources.list.d/steam-beta.list

0 comments on commit e7b8e36

Please sign in to comment.