1. Hi,

    I'm currently working on a bash script to automatically update rust and oxide every time a new update is available.

    I want to ensure that rust and oxide have both been updated to the same version before trigerring the update.

    For this, I need to check if last oxide release is made for last available rust update. I know I can easily get a build ID from rust server (current id being 1507290) but I don't know how to get any useful information about version in the oxide zip.

    Thank you for help
     
  2. Wulf

    Wulf Community Admin

  3. seems interesting, I'll take a look.

    I'm a bit afraid Oxide version could be the wrong one and won't load.

    Is there any way to prevent rust server to start if oxide does not load correctly ?
     
  4. OK, so, I took smooth restarter as an example to code my updater, this works well but I still need a way to prevent Rust to start if Oxide fails to load. Any ideas ?
     
  5. Wulf

    Wulf Community Admin

    The only way you could do that is to somehow search inside the Assembly-CSharp.dll for Oxide-specific code, else check for oxide.version when the server is started.
     
  6. Quite simple.
    Your current Oxide version can be read out by this:
    Code:
    int serverOxideVersion = Convert.ToInt32(Oxide.Core.OxideMod.Version.Patch);
    The find the latest available zip, means compiled commit result, check this url:
    Code:
    https://api.github.com/repos/OxideMod/Snapshots/commits
    To make a succesful webrequest, you need to add ad minimim a custom header to your request, as GitHub does require such:
    Code:
    Dictionary<string, string> userAgent = new Dictionary<string, string>();
    userAgent.Add("User-Agent", "OxideMod");
    
    The complete thing you need to check out are the functions "CheckOxideCommits()" and "APIResponse(int code, string response, string apiType, int numberCheck)" of my SmootRestarter. There's an "oxide" part in it, which checks the commits in the response for some specific things to get the latest current build out of the "message" string from that commit :)
    The latest commit does for example look like that, which represents the LATEST BUILD:
    Code:
      {
        "sha": "1566196e55e7b1e1777e4286eb86c19a748185f9",
        "commit": {
          "author": {
            "name": "Travis",
            "email": "[email protected]",
            "date": "2016-12-12T21:56:10Z"
          },
          "committer": {
            "name": "Travis",
            "email": "[email protected]",
            "date": "2016-12-12T21:56:10Z"
          },
          "message": "Oxide build 2814 from https://github.com/OxideMod/Oxide/commit/d0159e4",
          "tree": {
            "sha": "06095aeb28a5e34ca196bdf92a0e98e67125439b",
            "url": "https://api.github.com/repos/OxideMod/Snapshots/git/trees/06095aeb28a5e34ca196bdf92a0e98e67125439b"
          },
          "url": "https://api.github.com/repos/OxideMod/Snapshots/git/commits/1566196e55e7b1e1777e4286eb86c19a748185f9",
          "comment_count": 0
        },
        "url": "https://api.github.com/repos/OxideMod/Snapshots/commits/1566196e55e7b1e1777e4286eb86c19a748185f9",
        "html_url": "https://github.com/OxideMod/Snapshots/commit/1566196e55e7b1e1777e4286eb86c19a748185f9",
        "comments_url": "https://api.github.com/repos/OxideMod/Snapshots/commits/1566196e55e7b1e1777e4286eb86c19a748185f9/comments",
        "author": null,
        "committer": null,
        "parents": [
          {
            "sha": "57709872bc031826728d5d5da6e33ec7e9769a3a",
            "url": "https://api.github.com/repos/OxideMod/Snapshots/commits/57709872bc031826728d5d5da6e33ec7e9769a3a",
            "html_url": "https://github.com/OxideMod/Snapshots/commit/57709872bc031826728d5d5da6e33ec7e9769a3a"
          }
        ]
      }
    The URL request can be filtered by a given timeframe=limit you want to check back