In my previous article I talked about the broken links in my Steam installation. Today I got annoyed by making this fix always by hand evertime I start Steam. I switch a couple of times per day from my x220t (for work) to my desktop (for gaming) Frist thought was to modify the offical steam.sh Steam startscript but updates will remove my changes and ofc it is not nice to handle. So I decided to automate the fix/workaround. The workaround consists of two scripts:
Start steam and initiate fix-script
1 2 3 4 5 6 7 8 9 10
#!/bin/sh # This script is made to work with a second script. # The second script will be started in a seperate terminal and fix the borken symbolic links for steam. # check out www.a123qwertz567.de for the complete set of scripts. # made by S.K. 22.07.2015 # Open steam in seperate terminal and hold it open for error output xfce4-terminal -x steam -H #Open Terminal for the fix link script xfce4-terminal --working-directory=~ --command="bash ./fix_steam_symboliclink.sh" --geometry=50x8 --title="Fixing Steam script" --hide-menubar
As you can see the first script just opens two terminals, one running steam and one running my fixscript. Run Steam in a terminal makes sense for me to get output if anything isn't working. I make use of xfce-terminal because hat is my desktop enviroment. If you use another terminal you have to rework this part. Save this script where you want (I saved it in my home) and make it executable:
chmod +x ~/start_steam.sh
Fix the broken link
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
#!/bin/sh # This script is made to work with a second script. # The second script will open two terminals, one for starting steam and one for start this fixing script. # check out www.a123qwertz567.de for the complete set of scripts # made by Stefan Kerstan 22.07.2015 # Wait steam to start echo "Please wait till steam is started..." # Set to sleep for 15 seconds # 15 seconds is the average time steam needs to start. Measured out with a stopwatch sleep 20 echo "Steam should be fully started now." # check if link is already ok # list the ~/.steam directory and grep for the FIXED link and cut the part out TEST=$(ls -l --color ~/.steam | grep "share/Steam" | cut -d "." -f 3) # Test echo for chech the string # echo "$TEST" # Check if the link is already fixed or not.. if [ "$TEST" = "local/share/Steam/" ] then # Link fixed. Nothing to do here. echo "Link ok" echo "Have fun with your fixed Steam" else # Link broken echo "Link broken" # Remove old symbolic link" rm ~/.steam/root # Set new symbolic link ln -s ~/.local/share/Steam/ ~/.steam/root # check if link ok now TEST2=$(ls -l --color ~/.steam | grep "share/Steam" | cut -d "." -f 3) if [ "$TEST2" = "local/share/Steam/" ] then echo "Link replaced" echo "Have fun with your fixed Steam" else echo "ERORR: Link couldn't be replaced. Check the link by hand!" fi fi echo " " read -p "Press any key to quit this window..."
The second script is a bit more intersting. It "scans" the folder for the link and only replaces it if it's broken. Of course there is some text output to make it less boring to wait. Hopefully one day this will be fixed by Valve....Save this script in the same folder with the first script because the start script refers to it. Otherwise you have to rework the script. Make this script executable, too:
chmod +x ~/fix_steam_symboliclink.sh
Sometimes I get the output from my script.
"ERORR: Link couldn't be replaced. Check the link by hand!"
But the link is correctly replaced. I am not sure what the problem is. Maybe I will fix this in the future :D
When I shutdown my system, xfce saves the session and reloads it on the next boot. When Steam is saved in this session the link ist broken after a reboot. I simply quit or kill Steam and restart it with the script. If someone has a better solution please let me know.