]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blobdiff - src/initscripts/init.d/networking/red
Add aliases to backup and run setaliases at red start (if red=static only)
[people/pmueller/ipfire-2.x.git] / src / initscripts / init.d / networking / red
index aa5108a77adc2ead80603099b29a35ee2689fec7..f90e07378d5d3767d91f3a1a862fb5f282471681 100644 (file)
@@ -122,8 +122,40 @@ case "${1}" in
                        evaluate_retval
                        
                        run_subdir ${rc_base}/init.d/networking/red.up/
-                       
+
+                       # Configure aliases only if red static
+                       /usr/local/bin/setaliases
+
                elif [ "${TYPE}" == "DHCP" ]; then
+
+                       if [ -e $LEASEINFO ]; then
+                               boot_mesg -n "Stopping dhcpcd on the ${DEVICE} interface..."
+                               . $LEASEINFO
+                               if [ "$LEASETIME" = "4294967295" ]; then
+                                       # do nothing, just echo ok
+                                       echo ""
+                                       echo_ok
+                               else
+                                       if [ -n "$DHCP_STOP" ]; then
+                                               /sbin/dhcpcd ${DEVICE} $DHCP_STOP &> /dev/null
+                                               RET="$?"
+                                               if [ "$RET" -eq 0 ]; then
+                                                       echo ""
+                                                       echo_ok
+                                               elif [ "$RET" -eq 1 ]; then
+                                                       boot_mesg "dhcpcd not running!" ${WARNING}
+                                                       echo_warning
+                                               else
+                                                       echo ""
+                                                       echo_failure
+                                               fi
+                                       else
+                                               echo ""
+                                               killproc dhcpcd
+                                       fi
+                               fi
+                       fi
+
                        boot_mesg -n "Starting dhcpcd on the ${DEVICE} interface..."            
                        echo -n "${DEVICE}" > /var/ipfire/red/iface
 
@@ -180,6 +212,7 @@ case "${1}" in
                                echo "$GATEWAY gateway"  >> /tmp/hosts
                                mv /tmp/hosts /etc/hosts
                                echo "$GATEWAY" > /var/ipfire/red/remote-ipaddress
+                               touch /var/ipfire/red/active
                        else
                                echo ""
                                $(exit "$RET")
@@ -364,8 +397,8 @@ case "${1}" in
                        /usr/bin/vnstat -u -i ppp0 -r --enable --force > /dev/null 2>&1
                        /etc/rc.d/init.d/connectd start
                        # Add a NaN value to ppp0 rrd to supress spikes at reconnect
-                       rrdtool $RRDLOG/collectd/localhost/interface/if_octets-ppp0.rrf \
-                               $(date +%s)::
+                       rrdtool update $RRDLOG/collectd/localhost/interface/if_octets-ppp0.rrd \
+                               $(date +%s):: > /dev/null 2>&1
                        exit 0
                fi
                ;;
@@ -423,8 +456,8 @@ case "${1}" in
                        killall -w -s TERM /usr/sbin/pppd 2>/dev/null
                        evaluate_retval
                        # Add a NaN value to ppp0 rrd to supress spikes at reconnect
-                       rrdtool $RRDLOG/collectd/localhost/interface/if_octets-ppp0.rrf \
-                               $(date +%s)::
+                       rrdtool update $RRDLOG/collectd/localhost/interface/if_octets-ppp0.rrd \
+                               $(date +%s):: > /dev/null 2>&1
                fi
 
                if [ "$DEVICE" != "${GREEN_DEV}" ] && [ "$DEVICE" != "" ]; then