Home > SRCDS > SRCDS Linux auto-update fix

SRCDS Linux auto-update fix

The Problem

For some reason the Linux version of the dedicated server does not auto-update properly. It will simply fail to find the srcds bin file and have you do it manually for every update which gets very frustrating.

The problem originates from the introduction of a new subdirectory for all “new” source engine games. Luckily, this can be fixed with just two new “cd” lines in the script file!

The Fix

  1. Find and open the file srcds_run for editing (It will be a script file). It can be found in the game directory like /orangebox or /l4d
  2. search for the line update(). It can be found around line number 295.
  3. Make it look like this:
    update() {
        PWD=pwd
        cd ..
        updatesingle
        cd $PWD
    }

This should update any “new” srcds server by going back one directory, running srcds, and returning to the previous directory.

Notes
I suggest saving this new copy of srcds_run as something else like “srcds_run_tf2″. This will prevent the file from ever being overwritten by an update and will keep the original file if ever needed again.

Updated: Nov 26th
- Made this how-to more generic for any game like l4d

Categories: SRCDS Tags: ,
  • Guest

    update() {
    PWD=`pwd`
    cd ..
    updatesingle
    cd $PWD
    }


    Nice work so far, except you forgot the backticks around pwd.
    It will do fine with backticks, but won't work without.

    Explanation:
    Backticks will make the shell (I think bash is used) to execute the command between the ticks and write the output into PWD. Without it would degrade to a pointless copy variable content from undefined variable, causing the error as described.
  • Dominic Baranski
    lol, it's all right.

    I actually have another solution as well that might take care of having two separate files and the need to check them for updates individually.

    Create a "patch" with the updated code in it and run the patch on every update..


    update() {
    PWD=pwd
    cd ..
    updatesingle
    patch srcds_run updatefix.patch
    cd $PWD
    }


    The only downside (that is probably fixable with a > /dev/null) is every time the patch is run it creates a "rejected hunk" file for patches that were not applied.

    I'll probably update the posting with the patch sometime soon.

    Hope that helps!
  • Guest
    Sorry, repeated the note...
    OK, 03:30 local time, i beg your pardon...
  • Guest
    Copy the file "srcds_run" to "srcds_run_fixed".
    Steam will leave it alone and you have an working copy.

    Anyways must check from time to time, if srcds_run is modified.

    Again, using a regular expression to replace stuff within an executable is very keen and likely to cause unexpected results.
  • Guest
    It will cause steam to install the whole game again within the orangebox-directory (for dod:s) and then run the still unpatched version from ..!

    Although Valve does many stupid things with srcds, this one is on purpose.

    Anyways, if steam verifys the integrity of the files it will delete that "patch". Using perl to defeat the integrity check is stupid at best. The approach described using backticks with pwd will do fine and you won't need a cron.

    Interesting approach nevertheless but way off course.
  • Qain
    I had some issues with the updater as well. I tried using this fix to the "update()" function, and it caused the DS to throw this error:


    HLDS installation up to date
    ./srcds_run_l4d: line 389: ./srcds_i486: No such file or directory
    Add "-debug" to the ./srcds_run_l4d command line to generate
    a debug.log to help with solving this problem


    I decided to take a different approach to the problem and realized the real issue, was not with the update() or the updatesingle() functions. It is steam's relative location to ./srcds_run. It should be "../steam" not "./steam"

    here is the patch for updating this variable:

    --- srcds_run 2009-05-05 00:15:23.000000000 -0400
    +++ srcds_run_l4d 2009-05-06 10:09:12.000000000 -0400
    @@ -85,7 +85,7 @@
    shift ;;
    "-autoupdate")
    AUTO_UPDATE="yes"
    - STEAM="./steam"
    + STEAM="../steam"
    RESTART="yes" ;;
    "-steamerr")
    STEAMERR=1 ;;



    Or the simpler way of doing it.

    Search for line 88
    line should be
    STEAM="./steam"

    change it to
    STEAM="../steam"

    Save the file and you should be good.



    Hope this helps everyone!
  • Since updates break the `cd ..` fix I made this:

    perl -pi.bak -e 's/updatesingle[^;(]/cd ..; updatesingle; cd orangebox;\n/g;' /home/hlds/orangebox/srcds_run

    or crontab style:

    55 * * * * perl -pi.bak -e 's/updatesingle[^;(]/cd ..; updatesingle; cd orangebox;\n/g;' /home/hlds/orangebox/srcds_run
  • frisky
    thanks!!!!!!!!!!!!!!!!!!!
  • You're awesome. Thanks. I always wondered what I was doing wrong and why I had to run updates manually.

    Have they updated the srcds_run file very often, requiring you to re-modify/fix the file?
blog comments powered by Disqus