blob: 7ea44e74b47d2e8061d37280eacb522c045059b9 (
plain) (
blame)
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
|
#!/bin/ash
# Check whether a value should be considered true/on. Checks for
# 'on', 'yes', 'true', or 1, in either upper- or lowercase, but not
# mixed case.
is_on() {
[ "$1" = "ON" ] || [ "$1" = "on" ] || [ "$1" = "YES" ] || [ "$1" = "yes" ] || [ "$1" = "true" ] || [ "$1" = "TRUE" ] || [ "$1" -ne 0 ] 2>/dev/null || return 1
return 0
}
# Checks whether we're running bwLehrpool/OpenSLX in debug mode.
# Either $SLX_DEBUG is_on, or 'debug' is passed on KCL.
is_debug() {
if [ -z "$SLX_PXE_SERVER_IP" ]; then
if [ -s /opt/openslx/config ]; then
. /opt/openslx/config
elif [ -s /etc/openslx ]; then
. /etc/openslx
fi
fi
# Replace function for future calls as this is const
if is_on "$SLX_DEBUG" || grep -qE '(^|[[:space:]]|\bslx\.)debug($|[[:space:]]|=)' "/proc/cmdline"; then
is_debug() {
return 0
}
else
is_debug() {
return 1
}
fi
is_debug
}
|