-
Notifications
You must be signed in to change notification settings - Fork 1
/
configCheck.sh
92 lines (82 loc) · 1.89 KB
/
configCheck.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/bin/bash
if [[ ! -d "$MPV__CONFIG_DIR" ]]
then
>&2 ls -lA "$MPV__CONFIG_DIR"
>&2 echo 'Exiting because directory `'${MPV__CONFIG_DIR}'` not found'
exit 1
fi
if [[ ! -f "$MPV__INPUT_CONF" ]]
then
>&2 ls -lA "$MPV__INPUT_CONF"
>&2 echo 'Exiting because file `'${MPV__INPUT_CONF}'` not found'
exit 1
fi
if [[ ! -r "$MPV__INPUT_CONF" ]]
then
>&2 ls -lA "$MPV__INPUT_CONF"
>&2 echo 'Exiting because file `'${MPV__INPUT_CONF}'` is not readable'
exit 1
fi
if [[ "$VNC_PORT" == "0" || "$VNC_PORT" == "" ]]
then
VNC_PORT="-1"
fi
if [[ "$VNC_SOCKET_PERMS" == "0" || "$VNC_SOCKET_PERMS" == "" ]]
then
VNC_SOCKET_PERMS="0600"
fi
if [[ "$VNC_SOCKET_PATH" == "0" || "$VNC_SOCKET_PATH" == "" ]]
then
VNC_SOCKET_PATH="${DIR}/vncsocket"
fi
int_re='^[0-9]+$'
bool_re='^[01]$'
#float_re='^[0-9]+(?:\.(?:[0-9]+)?)?$'
float_re='^[0-9]+$|^[0-9]+\.$|^[0-9]+\.[0-9]+$'
if [[ "$GUEST_DISPLAY" == "" ]]
then
GUEST_DISPLAY=":44"
elif [[ "$GUEST_DISPLAY" =~ $int_re ]]
then
GUEST_DISPLAY=":${GUEST_DISPLAY}"
fi
if [[ "$MP" == "" ]]
then
MP=2
elif [[ ! "$MP" =~ $int_re ]]
then
>&2 echo 'config.sh: $MP must be an integer. Exiting.'
exit 1
elif (( MP < 0 || MP > 8 ))
then
>&2 echo 'config.sh: $MP must be [0..8]. Exiting.'
exit 1
fi
if [[ "$REMINDER_ABOUT_GIT_PULL" == "" ]]
then
REMINDER_ABOUT_GIT_PULL=1
elif [[ ! "$REMINDER_ABOUT_GIT_PULL" =~ $bool_re ]]
then
>&2 echo 'config.sh: $REMINDER_ABOUT_GIT_PULL must be 0 or 1. Exiting.'
exit 1
fi
if [[ "$AUTOLAUNCH_X11WID_SH" == "" ]]
then
AUTOLAUNCH_X11WID_SH=1
elif [[ ! "$AUTOLAUNCH_X11WID_SH" =~ $bool_re ]]
then
>&2 echo 'config.sh: $AUTOLAUNCH_X11WID_SH must be 0 or 1. Exiting.'
exit 1
fi
if [[ "$FORCE_RERENDER_EVERY" == "" ]]
then
FORCE_RERENDER_EVERY=1.0
elif ! [[ "$FORCE_RERENDER_EVERY" =~ $float_re ]]
then
>&2 echo 'FORCE_RERENDER_EVERY must be a float number in config.sh'
exit 1
fi
unset int_re
unset bool_re
unset float_re
mkdir -p "$MPV__SHADER_CACHE"