Skip to content

Instantly share code, notes, and snippets.

@boltronics
Forked from grindars/steam_bootstrap.sh
Last active December 16, 2015 18:28
Show Gist options
  • Save boltronics/5477467 to your computer and use it in GitHub Desktop.
Save boltronics/5477467 to your computer and use it in GitHub Desktop.
Steam installer for Debian GNU/Linux
#!/bin/bash
#
# Steam installer for Debian wheezy (32- and 64-bit)
#
# Place into empty directory and run.
#
download() {
local url="$1"
local filename="$(basename "$url")"
if [ ! -f "$filename" ]; then
wget -c "$url" -O "$filename.part"
mv "$filename.part" "$filename"
fi
}
package() {
local url="$1"
local target="$2"
download "$url"
mkdir -p "$target"
ar p "$(basename "$url")" data.tar.gz | tar xz -C "$target"
}
set -e
declare -r STEAMCONFIG="${HOME}/.steam"
declare -r LAUNCHSTEAMPLATFORM="ubuntu12_32"
declare -r LAUNCHSTEAMBOOTSTRAPFILE="${PWD}/tree/usr/lib/steam/bootstraplinux_${LAUNCHSTEAMPLATFORM}.tar.xz"
declare -r STEAM_DATA_HOME=${XDG_DATA_HOME:-$HOME/.local/share}
declare -r STEAMDIR="$STEAM_DATA_HOME/Steam"
package http://media.steampowered.com/client/installer/steam.deb "${PWD}/tree"
if [ ! -d "$STEAMCONFIG" ]; then
mkdir "$STEAMCONFIG"
fi
echo "Setting up Steam content in $STEAMDIR"
mkdir -p "${STEAMDIR}"
tar xJf "${LAUNCHSTEAMBOOTSTRAPFILE}" -C "${STEAMDIR}"
if [ ! -d ~/bin ]; then
mkdir ~/bin
fi
cat > "${HOME}/bin/steam" <<EOF
#!/bin/bash
#export STEAM_RUNTIME=0
#export STEAM_RUNTIME=debug
declare -r STEAMDIR="\${HOME}/.local/share/Steam"
if [ -z "\${LD_LIBRARY_PATH}" ]; then
LD_LIBRARY_PATH="\${STEAMDIR}/compat_libraries/lib/i386-linux-gnu"
else
LD_LIBRARY_PATH="\${STEAMDIR}/compat_libraries/lib/i386-linux-gnu:\${LD_LIBRARY_PATH}"
fi
export LD_LIBRARY_PATH
exec "\${STEAMDIR}/steam.sh" "\$@"
EOF
chmod +x "${HOME}/bin/steam"
echo "Installing Ubuntu packages"
mkdir -p "${STEAMDIR}/compat_libraries"
package http://security.ubuntu.com/ubuntu/pool/main/e/eglibc/libc6_2.15-0ubuntu10.2_i386.deb "${STEAMDIR}/compat_libraries"
echo "Installing Adobe Flash"
download https://fpdownload.macromedia.com/get/flashplayer/pdc/11.2.202.280/install_flash_player_11_linux.i386.tar.gz
mkdir ${PWD}/flash
tar zxf install_flash_player_11_linux.i386.tar.gz -C ${PWD}/flash
mkdir -p "${STEAMDIR}/ubuntu12_32/plugins"
cp -f ${PWD}/flash/libflashplayer.so "${STEAMDIR}/ubuntu12_32/plugins/"
@boltronics
Copy link
Author

I disdain (in general) scripts that automatically modify my .bashrc file, or any other file the user is expected to manage her/himself. Wheezy's default /etc/skel/.profile already prepends $HOME/bin to $PATH if the directory exits, so I use that instead.

Further, I don't care for applications trying to manage my desktop icons. If I want them, I'll add them myself. As such, I removed that part of the script also.

The environment variable export STEAM_RUNTIME=0 was added to avoid an error upon startup about a lack of disk space.

Lastly, the Flash plugin is now automatically downloaded and installed since it is apparently required to play Steam videos. I would have preferred to just symlink to /usr/lib/flashplugin-nonfree/libflashplayer.so to ease security updates, but if on an amd64 the architecture would probably be incompatible.

To do:
Use mktemp and/or a local cache directory (~/.cache/steam_bootstrap?) to enable this to be run from anywhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment