hotfix for mac-detection and various variable names (#139)
* Change Client-Name: The client name inside LVA is not capable of having spaces in the name. Fixed the example. * Add first version of Docker-Compose for developers * Add variable for network-interface and auto detection by default * Added autodetection for the MAC-Address based on the detected or specified network-interface. * Switched from listening on all IP-Addresses to the IP of the default interface, usually u set the correct network-interface and it will automatically detect the right IP-Address. * Added missing variables, fixed variables names * Fixed not working variables for example sound-files. * Moved the auto-name creation from shell to python. The name is no longer mandatory, it will be generated if no name is given.
This commit is contained in:
1 parent
f72e5c8d30
commit
4052daae01
11 files changed
+256
-113
No files matched your search
+46
-29
@@ -1,31 +1,6 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
### Generate name for this client
|
||||
# Get active interface
|
||||
IFACE=$(ip route | grep default | awk '{print $5}' | head -n 1)
|
||||
|
||||
# Check if IFACE is empty
|
||||
if [ -z "$IFACE" ]; then
|
||||
echo "No active network interface found."
|
||||
fi
|
||||
|
||||
# Check if interface directory exists
|
||||
if [ ! -e "/sys/class/net/$IFACE/address" ]; then
|
||||
echo "Interface $IFACE does not exist or has no MAC address."
|
||||
fi
|
||||
|
||||
# Read MAC address and remove ':'
|
||||
MAC=$(cat /sys/class/net/$IFACE/address | tr -d ':')
|
||||
|
||||
if [ -z "$MAC" ]; then
|
||||
echo "Could not read MAC address."
|
||||
fi
|
||||
|
||||
# Generate CLIENT_NAME from it
|
||||
TEMP_CLIENT_NAME="lva-${MAC}"
|
||||
|
||||
|
||||
### Handlers
|
||||
# Handle parameters
|
||||
EXTRA_ARGS=()
|
||||
@@ -34,7 +9,6 @@ if [ "$ENABLE_DEBUG" = "1" ]; then
|
||||
EXTRA_ARGS+=( "--debug" )
|
||||
fi
|
||||
|
||||
CLIENT_NAME=${CLIENT_NAME:-$TEMP_CLIENT_NAME}
|
||||
if [ -n "${CLIENT_NAME}" ]; then
|
||||
EXTRA_ARGS+=( "--name" "$CLIENT_NAME" )
|
||||
fi
|
||||
@@ -44,6 +18,15 @@ if [ -n "${PREFERENCES_FILE}" ]; then
|
||||
EXTRA_ARGS+=( "--preferences-file" "$PREFERENCES_FILE" )
|
||||
fi
|
||||
|
||||
if [ -n "${NETWORK_INTERFACE}" ]; then
|
||||
EXTRA_ARGS+=( "--network-interface" "$NETWORK_INTERFACE" )
|
||||
fi
|
||||
|
||||
# IP-ADDRESS
|
||||
if [ -n "${HOST}" ]; then
|
||||
EXTRA_ARGS+=( "--host" "$HOST" )
|
||||
fi
|
||||
|
||||
PORT=${PORT:-6053}
|
||||
if [ -n "${PORT}" ]; then
|
||||
EXTRA_ARGS+=( "--port" "$PORT" )
|
||||
@@ -61,6 +44,38 @@ if [ "$ENABLE_THINKING_SOUND" = "1" ]; then
|
||||
EXTRA_ARGS+=( "--enable-thinking-sound" )
|
||||
fi
|
||||
|
||||
if [ -n "${WAKE_MODEL}" ]; then
|
||||
EXTRA_ARGS+=( "--wake-model" "$WAKE_MODEL" )
|
||||
fi
|
||||
|
||||
if [ -n "${STOP_MODEL}" ]; then
|
||||
EXTRA_ARGS+=( "--stop-model" "$STOP_MODEL" )
|
||||
fi
|
||||
|
||||
if [ -n "${REFACTORY_SECONDS}" ]; then
|
||||
EXTRA_ARGS+=( "--refractory-seconds" "$REFACTORY_SECONDS" )
|
||||
fi
|
||||
|
||||
if [ -n "${WAKEUP_SOUND}" ]; then
|
||||
EXTRA_ARGS+=( "--wakeup-sound" "$WAKEUP_SOUND" )
|
||||
fi
|
||||
|
||||
if [ -n "${TIMER_FINISHED_SOUND}" ]; then
|
||||
EXTRA_ARGS+=( "--timer-finished-sound" "$TIMER_FINISHED_SOUND" )
|
||||
fi
|
||||
|
||||
if [ -n "${PROCESSING_SOUND}" ]; then
|
||||
EXTRA_ARGS+=( "--processing-sound" "$PROCESSING_SOUND" )
|
||||
fi
|
||||
|
||||
if [ -n "${MUTE_SOUND}" ]; then
|
||||
EXTRA_ARGS+=( "--mute-sound" "$MUTE_SOUND" )
|
||||
fi
|
||||
|
||||
if [ -n "${UNMUTE_SOUND}" ]; then
|
||||
EXTRA_ARGS+=( "--unmute-sound" "$UNMUTE_SOUND" )
|
||||
fi
|
||||
|
||||
|
||||
### Wait for PulseAudio
|
||||
# Wait for PulseAudio to be available before starting the application
|
||||
@@ -113,7 +128,9 @@ if [ "$LIST_DEVICES" = "1" ]; then
|
||||
./script/run "$@" "${EXTRA_ARGS[@]}" --list-input-devices
|
||||
echo "list output devices"
|
||||
./script/run "$@" "${EXTRA_ARGS[@]}" --list-output-devices
|
||||
else
|
||||
echo "starting application"
|
||||
exec ./script/run "$@" "${EXTRA_ARGS[@]}"
|
||||
echo "wait 20s and then starting the application"
|
||||
sleep 20
|
||||
fi
|
||||
|
||||
echo "starting application"
|
||||
exec ./script/run "$@" "${EXTRA_ARGS[@]}"
|
||||
Reference in new issue
Block a user