-
Notifications
You must be signed in to change notification settings - Fork 276
/
valheim-plus-updater
executable file
·38 lines (31 loc) · 1.11 KB
/
valheim-plus-updater
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
#!/bin/bash
# valheim-plus-updater is being called by
# valheim-updater when $VALHEIM_PLUS=true
# It downloads the ValheimPlus mod and merges
# the downloaded archive with the vanilla
# Valheim server into /opt/valheim/plus
# Include defaults and common functions
. /usr/local/etc/valheim/defaults
. /usr/local/etc/valheim/common
main() {
local api_response
local download_url
local remote_updated_at
if ! api_response=$(curl -sfSL "https://api.github.com/repos/$VALHEIM_PLUS_REPO/releases/$VALHEIM_PLUS_RELEASE"); then
fatal "Error: could not retrieve ValheimPlus release info from Github API"
fi
api_response=$(jq -r ".assets[] | select(.name == \"$vp_zipfile\")" <<< "$api_response" )
download_url=$(jq -r ".browser_download_url" <<< "$api_response" )
remote_updated_at=$(jq -r ".updated_at" <<< "$api_response" )
check_for_mod_update \
"$download_url" \
"$remote_updated_at" \
"$vp_zipfile" \
"$vp_mergefile" \
"$vp_download_path" \
"$vp_config_path" \
"extracted" \
"$vp_install_path" \
"ValheimPlus"
}
main