forked from bdsx/bdsx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bdsx.sh
executable file
·48 lines (38 loc) · 1.12 KB
/
bdsx.sh
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
#!/bin/sh
cwd=$(pwd)
SCRIPT=$(readlink -f "$0")
cd $(dirname "$SCRIPT")
# check wine
if [ -x "$(command -v wine)" ]; then
WINE=wine
elif [ -x "$(command -v wine64)" ]; then
WINE=wine64
else
echo 'Error: bdsx requires wine. Please install wine first' >&2
exit $?
fi
# enable linux executables on wine
k='HKLM\System\CurrentControlSet\Control\Session Manager\Environment'
pathext_orig=$( $WINE reg query "$k" /v PATHEXT | tr -d '\r' | awk '/^ /{ print $3 }' )
echo "$pathext_orig" | grep -qE '(^|;)\.(;|$)' || $WINE reg add "$k" /v PATHEXT /f /d "${pathext_orig};."
# check modules
if [ ! -d "./node_modules" ]; then ./update.sh; fi
if [ $? != 0 ]; then exit $?; fi
if [ ! -f "./bedrock_server/bedrock_server.exe" ]; then ./update.sh; fi
if [ $? != 0 ]; then exit $?; fi
# remove junk
rm ./bedrock_server/bdsx_shell_data.ini >/dev/null 2>/dev/null
# loop begin
while :; do
# shellprepare
npm run -s shellprepare
if [ $? != 1 ]; then break; fi
# launch
cd bedrock_server
WINEDLLOVERRIDES="VCRUNTIME140_1=n,b" WINEDEBUG=fixme-all $WINE ./bedrock_server.exe ..
echo exit=$?>>bdsx_shell_data.ini
cd ..
# loop end
done
cd $cwd
exit $?