Commit e9504fb8 authored by Francklin Simo's avatar Francklin Simo

simplify configuration during installation

parent 3c06e79d
......@@ -144,10 +144,12 @@ load_net_config(){
db_get opensand-daemon/network/lan_ipv4
LAN_IPV4=$RET
else
LAN_IPV4=`ip addr show ${LAN_IFACE} | grep -o -e "inet [^ ]*" | \grep -o -e "[^ ]*$"`
LAN_IPV4=`echo ${LAN_IPV4} | cut -f 1 -d ' '`
if [ -z "$LAN_IPV4" ]; then
halt_on_error "cannot retrieve ${LAN_IFACE} IPv4 address, please select ADVANCED mode or assign an address"
if [ "$LAN_IFACE" != "" && "LAN_IFACE" != "None" ]; then
LAN_IPV4=`ip addr show ${LAN_IFACE} | grep -o -e "inet [^ ]*" | \grep -o -e "[^ ]*$"`
LAN_IPV4=`echo ${LAN_IPV4} | cut -f 1 -d ' '`
if [ -z "$LAN_IPV4" ]; then
halt_on_error "cannot retrieve ${LAN_IFACE} IPv4 address, please select ADVANCED mode or assign an address"
fi
fi
fi
......@@ -267,7 +269,7 @@ EOF
}
set_dhcp_client(){
if [ "$DHCP" != "false" ]; then
if [ "$DHCP" != "false" && "$LAN_IFACE" != "" && "$LAN_IFACE" != "None" ]; then
echo "Starting DHCP client"
evecho $DHCP_CLIENT_CMD $LAN_IFACE 1>/dev/null
fi
......@@ -282,7 +284,7 @@ config(){
return
fi
if [[ $NAME != SAT && $NAME != GW-PHY* ]]; then
if [[ $NAME != SAT && $NAME != GW-PHY* && $LAN_IFACE != "" && $LAN_IFACE != "None" ]]; then
echo "# Configuring sysctl"
echo " See /etc/default/opensand-daemon to avoid this modifications"
set_sysctl
......
......@@ -98,9 +98,6 @@ read_conf(){
COMMAND_PORT=$RET
db_get opensand-daemon/state/port
STATE_PORT=$RET
db_get opensand-daemon/network/config_level
RET=`echo $RET | tr 'A-Z' 'a-z'`
CONFIG_LEVEL=$RET
db_get opensand-daemon/network/dhcp
DHCP=$RET
db_get opensand-daemon/network/emu_iface
......
......@@ -193,16 +193,17 @@ configure(){
db_subst opensand-daemon/network/emu_iface ifaces_list "${IFACES_LIST}"
db_input high opensand-daemon/network/emu_iface || true
fi
if [ "$COPY_EMU_IFACE_TO_SERVICE" = "true" ]; then
db_reset opensand-daemon/service/interface
db_get opensand-daemon/network/emu_iface
db_set opensand-daemon/service/interface "${RET}"
fi
db_endblock
;;
16)
db_beginblock
if [ "$COPY_EMU_IFACE_TO_SERVICE" = "true" ]; then
db_get opensand-daemon/network/emu_iface
AVAHI_INTERFACE=$RET
db_reset opensand-daemon/service/interface
db_set opensand-daemon/service/interface "${AVAHI_INTERFACE}"
fi
if [ "$NAME" != "WS" -a "$NAME" != "GW-NET-ACC" ]; then
db_get opensand-daemon/network/emu_iface
EMU_IFACE=${RET}
......@@ -250,7 +251,7 @@ configure(){
if [ "$NAME" = "ST" -o "$NAME" = "GW" -o "$NAME" = "GW-NET-ACC" ]; then
db_beginblock
net="63"
if [ "$NAME" = "ST" ]; then
if [ "$NAME" = "ST" ]; then
add=${INST}
else
add=254
......@@ -326,12 +327,11 @@ configure(){
;;
22)
db_beginblock
LAN_IFACES_LIST="None, ${IFACES_LIST}"
if [ "$NAME" != "SAT" -a "$NAME" != "GW-PHY" ]; then
add=1
if [ "$NAME" = "WS" ]; then
db_subst opensand-daemon/network/ws_lan_iface ifaces_list "${LAN_IFACES_LIST}"
db_input low opensand-daemon/network/ws_lan_iface || true
db_subst opensand-daemon/network/ws_lan_iface ifaces_list "${IFACES_LIST}"
db_input high opensand-daemon/network/ws_lan_iface || true
# use a random value to limit WS with the same address
# ST physical interface has address .1 and tap interface
# (opensand) has address .3
......@@ -339,24 +339,11 @@ configure(){
add=$((add % 252))
add=$((add + 4))
else
db_subst opensand-daemon/network/lan_iface ifaces_list "${LAN_IFACES_LIST}"
db_input low opensand-daemon/network/lan_iface || true
db_subst opensand-daemon/network/lan_iface ifaces_list "${IFACES_LIST}"
db_input high opensand-daemon/network/lan_iface || true
fi
fi
db_endblock
db_get opensand-daemon/network/ws_lan_iface
if [ "$RET" = "None" ]; then
db_reset opensand-daemon/network/ws_lan_iface
db_set opensand-daemon/network/ws_lan_iface ""
fi
db_get opensand-daemon/network/lan_iface
if [ "$RET" = "None" ]; then
db_reset opensand-daemon/network/lan_iface
db_set opensand-daemon/network/lan_iface ""
fi
db_endblock
;;
23)
db_beginblock
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment