Default to no static local IP address, but have the option to set one

This commit is contained in:
Bob Mottram 2015-11-29 15:28:12 +00:00
parent 6227eb6f63
commit 54b3daf9d4
2 changed files with 54 additions and 32 deletions

View File

@ -101,7 +101,8 @@ CPU_CORES=1
IPV6_NETWORK='2001:470:26:307'
# The static IP address of the system within the local network
LOCAL_NETWORK_STATIC_IP_ADDRESS="192.168.1.60"
# By default the IP address is dynamic within your LAN
LOCAL_NETWORK_STATIC_IP_ADDRESS=
# IP address of the router (gateway)
ROUTER_IP_ADDRESS="192.168.1.254"
@ -1291,6 +1292,9 @@ function install_not_on_BBB {
if [[ INSTALLING_ON_BBB == "yes" ]]; then
return
fi
if [ ! $LOCAL_NETWORK_STATIC_IP_ADDRESS ]; then
return
fi
echo '# This file describes the network interfaces available on your system' > /etc/network/interfaces
echo '# and how to activate them. For more information, see interfaces(5).' >> /etc/network/interfaces
@ -6975,7 +6979,10 @@ function configure_email {
echo "dc_readhost=''" >> /etc/exim4/update-exim4.conf.conf
echo "dc_relay_domains=''" >> /etc/exim4/update-exim4.conf.conf
echo "dc_minimaldns='false'" >> /etc/exim4/update-exim4.conf.conf
RELAY_NETS='192.168.1.0/24'
if [ $LOCAL_NETWORK_STATIC_IP_ADDRESS ]; then
RELAY_NETS=$(echo $LOCAL_NETWORK_STATIC_IP_ADDRESS | awk -F '.' '{print $1 "." $2 "." $3 ".0/24"}')
fi
echo "dc_relay_nets='$RELAY_NETS'" >> /etc/exim4/update-exim4.conf.conf
echo "dc_smarthost=''" >> /etc/exim4/update-exim4.conf.conf
echo "CFILEMODE='644'" >> /etc/exim4/update-exim4.conf.conf

View File

@ -180,8 +180,10 @@ function save_configuration_file {
echo "MY_NAME=$MY_NAME" >> $CONFIGURATION_FILE
fi
echo "MY_EMAIL_ADDRESS=$MY_EMAIL_ADDRESS" >> $CONFIGURATION_FILE
if [ $LOCAL_NETWORK_STATIC_IP_ADDRESS ]; then
echo "LOCAL_NETWORK_STATIC_IP_ADDRESS=$LOCAL_NETWORK_STATIC_IP_ADDRESS" >> $CONFIGURATION_FILE
echo "ROUTER_IP_ADDRESS=$ROUTER_IP_ADDRESS" >> $CONFIGURATION_FILE
fi
if [ $ENABLE_CJDNS ]; then
echo "ENABLE_CJDNS=$ENABLE_CJDNS" >> $CONFIGURATION_FILE
fi
@ -1091,6 +1093,18 @@ function interactive_configuration {
save_configuration_file
fi
SET_STATIC_IP="no"
dialog --title $"Static local IP address" \
--backtitle $"Freedombone Configuration" \
--defaultno \
--yesno $"\nDo you want to set a static local IP address for this system?\n\nFor example, 192.168.1.10" 10 60
sel=$?
case $sel in
0) SET_STATIC_IP="yes";;
255) exit 1;;
esac
if [[ $SET_STATIC_IP == "yes" ]]; then
if [ ! $LOCAL_NETWORK_STATIC_IP_ADDRESS ]; then
LOCAL_NETWORK_STATIC_IP_ADDRESS=$(grep 'LOCAL_NETWORK_STATIC_IP_ADDRESS' temp.cfg | awk -F '=' '{print $2}')
if [ ! $LOCAL_NETWORK_STATIC_IP_ADDRESS ]; then
@ -1119,6 +1133,7 @@ function interactive_configuration {
LOCAL_NETWORK_STATIC_IP_ADDRESS=$(cat $data | sed -n 1p)
ROUTER_IP_ADDRESS=$(cat $data | sed -n 2p)
save_configuration_file
fi
if [[ $SYSTEM_TYPE == "$VARIANT_WRITER" || $SYSTEM_TYPE == "$VARIANT_FULL" ]]; then
WIKI_DETAILS_COMPLETE=