File steamruntime-fix of Package steam.6312
#!/bin/bash
steam_dir=~/.local/share/Steam
runtime=$steam_dir/ubuntu12_32/steam-runtime
strip_quotes ()
{
local clean="$1"
clean="${clean%\"}"
clean="${clean#\"}"
echo "$clean"
}
# Many apps also ship a libstdc that causes issues in the same way the steam
# runtime version of the lib does. As such parse the config to get a list of
# library folders to search and remove such files. An example of a game that
# will not launch without this fix is Portal 2 (app 620). Unfortunately, there
# does not appear to be a method for running the script after a game has
# downloaded or before it launches so at best a steam restart will work.
config=$steam_dir/steamapps/libraryfolders.vdf
keys=($(cut -f2 "$config"))
values=($(cut -f4 "$config"))
# default steam library directory not in config file, nor runtime
directories=("$runtime" "$steam_dir/steamapps")
for ((i = 0; i < ${#keys[@]}; i++))
do
key=$(strip_quotes "${keys[$i]}")
# check if key is numeric instead of config option
if [ "$key" -eq "$key" ] 2>/dev/null; then
value=$(strip_quotes "${values[$i]}")
directories+=("$value/steamapps")
fi
done
echo "removing troublesome steam-runtime libs..."
for dir in "${directories[@]}"; do
echo "-> checking $dir"
find "$dir" -type f -name "libstdc*" -print -delete
done
echo "bringing in our fixed openssl libraries"
for lib in libcrypto.so.1.0.0 libssl.so.1.0.0; do
find "$runtime/i386" -name $lib | while read a
do
if [ -f /usr/lib/steam/lib/$lib ]; then
rm "$a"
ln -s /usr/lib/steam/lib/$lib "$a"
fi
done
find "$runtime/amd64" -name $lib | while read a
do
if [ -f /usr/lib/steam/lib64/$lib ]; then
rm "$a"
ln -s /usr/lib/steam/lib64/$lib "$a"
fi
done
done