forked from bdsx/bdsx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bdsx.sh
executable file
·55 lines (45 loc) · 1.22 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
49
50
51
52
53
54
55
#!/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
exitcode=$?
if [ $exitcode -eq 2 ]; then
rm -rf ./node_modules
./update.sh
continue
elif [ $exitcode -ne 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 $?