Browse Source

Change interface if on wifi

stockholm
Bob Mottram 5 years ago
parent
commit
536c078489
  1. 8
      src/freedombone-app-dlna
  2. 19
      src/freedombone-utils-config

8
src/freedombone-app-dlna

@ -199,9 +199,13 @@ function install_dlna_main {
fi
sed -i 's/#root_container=./root_container=B/g' /etc/minidlna.conf
if [[ $SYSTEM_TYPE != "mesh"* ]]; then
sed -i 's/#network_interface=/network_interface=eth0/g' /etc/minidlna.conf
if [[ $(config_param_exists WIFI_INTERFACE) == "0" ]]; then
sed -i 's/#network_interface=/network_interface=eth0/g' /etc/minidlna.conf
else
sed -i "s/#network_interface=/network_interface=$WIFI_INTERFACE/g" /etc/minidlna.conf
fi
else
sed -i 's/#network_interface=/network_interface=$WIFI_INTERFACE/g' /etc/minidlna.conf
sed -i "s/#network_interface=/network_interface=$WIFI_INTERFACE/g" /etc/minidlna.conf
fi
sed -i "s/#friendly_name=/friendly_name=\"${PROJECT_NAME} Media\"/g" /etc/minidlna.conf
sed -i 's|#db_dir=/var/cache/minidlna|db_dir=/var/cache/minidlna|g' /etc/minidlna.conf

19
src/freedombone-utils-config

@ -203,6 +203,25 @@ function read_config_param {
fi
}
function config_param_exists {
param_name="$1"
if [ ${#param_name} -gt 0 ]; then
if [ $CONFIGURATION_FILE ]; then
if [ -f $CONFIGURATION_FILE ]; then
if grep -q "${param_name}=" $CONFIGURATION_FILE; then
param_value=$(cat $CONFIGURATION_FILE | grep "${param_name}=" | head -n 1 | awk -F '=' '{print $2}')
if [ ${#param_value} -gt 0 ]; then
echo "1"
return
fi
fi
fi
fi
fi
echo "0"
}
function write_config_param {
param_name="$1"
param_value="$2"

Loading…
Cancel
Save