#!/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 }