Skip to content

Commit

Permalink
Added option to use github's releases of oxide instead of the umod we…
Browse files Browse the repository at this point in the history
…bsite
  • Loading branch information
Morgyn committed Dec 9, 2023
1 parent b69d7a6 commit b72db45
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 15 deletions.
11 changes: 8 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,16 @@ WORKDIR /app/restart_app
RUN npm install

# Setup scheduling support
ADD scheduler_app/ /app/scheduler_app/
WORKDIR /app/scheduler_app
ADD oxidegithub_app/ /app/oxidegithub_app/
WORKDIR /app/oxidegithub_app
RUN npm install

# Setup scheduling support
# Setup heartbeat
ADD heartbeat_app/ /app/heartbeat_app/
WORKDIR /app/heartbeat_app
RUN npm install

# Setup github oxide support
ADD heartbeat_app/ /app/heartbeat_app/
WORKDIR /app/heartbeat_app
RUN npm install
Expand Down
12 changes: 12 additions & 0 deletions oxidegithub_app/app.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { extract } from '@extractus/feed-extractor';

extract('https://github.com/OxideMod/Oxide.Rust/releases.atom').then( (data) => {

const latestEntry = data.entries.reduce((latest, current) => {
const latestDate = new Date(latest.published);
const currentDate = new Date(current.published);
return currentDate > latestDate ? current : latest;
}, data.entries[0]);

console.log(`https://github.com/OxideMod/Oxide.Rust/releases/download/${latestEntry.title}/Oxide.Rust-linux.zip`);
});
5 changes: 5 additions & 0 deletions oxidegithub_app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"dependencies": {
"@extractus/feed-extractor": "^7.0.8"
}
}
19 changes: 7 additions & 12 deletions start_rust.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,20 +100,15 @@ fi
# Check if Oxide is enabled
if [ "$RUST_OXIDE_ENABLED" = "1" ]; then
# Next check if Oxide doesn't' exist, or if we want to always update it
INSTALL_OXIDE="0"
if [ ! -f "/steamcmd/rust/Oxide.Compiler" ]; then
INSTALL_OXIDE="1"
fi
if [ "$RUST_OXIDE_UPDATE_ON_BOOT" = "1" ]; then
INSTALL_OXIDE="1"
fi

# If necessary, download and install latest Oxide
if [ "$INSTALL_OXIDE" = "1" ]; then
echo "Downloading and installing latest Oxide.."
if [ ! -f "/steamcmd/rust/Oxide.Compiler" ] || [ "$RUST_OXIDE_UPDATE_ON_BOOT" = "1" ]; then

OXIDE_URL="https://umod.org/games/rust/download/develop"
if [ "$RUST_OXIDE_GITHUB" = "1" ]; then
OXIDE_URL="$(node /app/oxidegithub_app/app.mjs)"
fi
echo "Downloading and installing latest Oxide... (${OXIDE_URL})"
curl -sL $OXIDE_URL | bsdtar -xvf- -C /steamcmd/rust/
chmod 755 /steamcmd/rust/CSharpCompiler.x86_x64 > /dev/null 2>&1 &
chmod 755 /steamcmd/rust/Oxide.Compiler > /dev/null 2>&1 &
fi
fi

Expand Down

0 comments on commit b72db45

Please sign in to comment.