-
Notifications
You must be signed in to change notification settings - Fork 0
/
proton-update
executable file
·68 lines (62 loc) · 2.63 KB
/
proton-update
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
##### Update Proton install and link to : "/home/enshrouded/.steam/root/compatibilitytools.d/Proton-latest"
# v0.1 - POC
# VARS
_USERDIR="/home/enshrouded"
_WKGDIR="${_USERDIR}/enshrd-monitor"
_LOGFILE="${_WKGDIR}/update.log"
_SERVICEFILE="enshrd.service"
_TMPDLFOLDER="${_USERDIR}/tmpdl"
_PROTONLATEST=$(curl -s https://api.github.com/repos/GloriousEggroll/proton-ge-custom/releases/latest |awk '/tag_name/ {print $2}' |tr -d '"|,')
_PROTONCURVERSION=$(realpath ${_USERDIR}/.steam/root/compatibilitytools.d/Proton-latest |awk -F'/' '{print $NF}')
_INSTALLOC="${_USERDIR}/.steam/root/compatibilitytools.d"
### PRE
_LOGTHIS(){
local _LEVEL="$1"
local _MESSAGE="$2"
local _TIMESTAMP=$(date '+%Y-%m-%d %H:%M:%S')
printf "[${_TIMESTAMP}] [${_LEVEL}] ${_MESSAGE}\n" >>$_LOGFILE
}
# Start update if Current version does not match repository latest version
if [ "${_PROTONLATEST}" = "${_PROTONCURVERSION}" ]; then
_LOGTHIS INFO "Proton Repo Check: Update not needed"
exit 0
else
_LOGTHIS INFO "Proton Current Version: $_PROTONCURVERSION"
_LOGTHIS INFO "Upgrading to Proton Latest: $_PROTONLATEST"
fi
# stop service in case script is started lonely
if [ "$(sudo systemctl is-active enshrd.service)" = "active" ]; then
# stop service and backup map
_LOGTHIS INFO "Stopping service: $_SERVICEFILE"
sudo systemctl stop $_SERVICEFILE
sleep 5
# Clean monitoring files
>${_WKGDIR}/last_check
>${_WKGDIR}/log_news
>${_WKGDIR}/connected-users
>${_USERDIR}/enshroudedserver/logs/enshrouded_server.log
fi
### MAIN
[ -d "$_TMPDLFOLDER" ] || mkdir $_TMPDLFOLDER
cd $_TMPDLFOLDER
curl -sLOJ --connect-timeout 10 "https://github.com/GloriousEggroll/proton-ge-custom/releases/download/${_PROTONLATEST}/${_PROTONLATEST}.tar.gz" || { _LOGTHIS WARN "${_PROTONLATEST} Github download failed, skip install.."; exit 1; }
tar -xzf GE-Proton*.tar.gz -C ${_INSTALLOC}/
rm -rf ${_TMPDLFOLDER}/*
# Test if new proton bin is executable and if embedded wine64 works correctly
if [ -x "${_INSTALLOC}/${_PROTONLATEST}/proton" ]; then
if ${_INSTALLOC}/${_PROTONLATEST}/files/bin/wine64 --version >/dev/null 2>&1; then
_LOGTHIS INFO "${_PROTONLATEST} Execution tests Validated! Installing.."
else
_LOGTHIS WARN "${_PROTONLATEST} Execution tests Inconcistency [wine64], skip install.."
exit 1
fi
else
_LOGTHIS WARN "${_PROTONLATEST} Execution tests Inconcistency [proton], skip install.."
exit 1
fi
cd $_INSTALLOC
mv ${_PROTONLATEST}/user_settings.sample.py ${_PROTONLATEST}/user_settings.py
[ -h "${_INSTALLOC}/Proton-latest" ] && unlink ${_INSTALLOC}/Proton-latest
ln -s ${_INSTALLOC}/${_PROTONLATEST} ${_INSTALLOC}/Proton-latest
_LOGTHIS SUCCESS "${_PROTONLATEST} Install Complete!"