Adding support for post-up commands in ifupdown script.
authorDaniel Baumann <daniel@debian.org>
Sat, 1 Sep 2012 12:39:52 +0000 (14:39 +0200)
committerDaniel Baumann <daniel@debian.org>
Sat, 1 Sep 2012 12:39:52 +0000 (14:39 +0200)
scripts/debconfig/0020-ifupdown
scripts/debconfig/0020-ifupdown.templates

index fed660b..33250bd 100755 (executable)
@@ -67,6 +67,9 @@ _ETH0_NETMASK="${RET}" # string (w/o empty)
 db_get live-debconfig/ifupdown/eth0-network
 _ETH0_NETWORK="${RET}" # string (w/ empty)
 
+db_get live-debconfig/ifupdown/eth0-post-up
+_ETH0_POST_UP="${RET}" # string (w/ empty)
+
 db_get live-debconfig/ifupdown/nameserver-addresses
 _NAMESERVER_ADDRESSES="${RET}" # string (w/ empty)
 
@@ -108,6 +111,9 @@ db_fset live-debconfig/ifupdown/eth0-netmask seen false
 db_set live-debconfig/ifupdown/eth0-network "${_ETH0_NETWORK}"
 db_fset live-debconfig/ifupdown/eth0-network seen false
 
+db_set live-debconfig/ifupdown/eth0-post-up "${_ETH0_POST_UP}"
+db_fset live-debconfig/ifupdown/eth0-post-up seen false
+
 db_set live-debconfig/ifupdown/nameserver-addresses "${_NAMESERVER_ADDRESSES}"
 db_fset live-debconfig/ifupdown/nameserver-addresses seen false
 
@@ -168,6 +174,10 @@ case "${_ETH0_METHOD}" in
                db_go
 
                db_settitle live-debconfig/title
+               db_input high live-debconfig/ifupdown/eth0-post-up || true
+               db_go
+
+               db_settitle live-debconfig/title
                db_input high live-debconfig/ifupdown/nameserver-addresses || true
                db_go
                ;;
@@ -212,6 +222,11 @@ do
                eval _ETH${_NUMBER}_NETWORK="\"${RET}\"" # string (w/ empty)
        fi
 
+       if db_get live-debconfig/ifupdown/eth${_NUMBER}-post-up
+       then
+               eval _ETH${_NUMBER}_POST_UP="\"${RET}\"" # string (w/ empty)
+       fi
+
        _NUMBER="$((${_NUMBER} + 1))"
 done
 
@@ -265,6 +280,7 @@ do
        eval _GATEWAY="$`echo _ETH${_NUMBER}_GATEWAY`"
        eval _NETMASK="$`echo _ETH${_NUMBER}_NETMASK`"
        eval _NETWORK="$`echo _ETH${_NUMBER}_NETWORK`"
+       eval _POST_UP="$`echo _ETH${_NUMBER}_POST_UP`"
 
        if [ -z "${_METHOD}" ]
        then
@@ -326,6 +342,11 @@ EOF
                        then
                                echo "  network         ${_NETWORK}" >> /etc/network/interfaces.tmp
                        fi
+
+                       if [ -n "${_POST_UP}" ]
+                       then
+                               echo "  post-up         ${_POST_UP}" >> /etc/network/interfaces.tmp
+                       fi
                        ;;
        esac
 
index 1ba92e8..131dbe9 100644 (file)
@@ -81,6 +81,14 @@ Description: live-debconfig: Ethernet Network Address?
  .
  This defaults to empty.
 
+Template: live-debconfig/ifupdown/eth0-post-up
+Type: string
+Default:
+Description: live-debconfig: Ethernet post-up Command?
+ What should be the post-up command for eth0?
+ .
+ This defaults to empty.
+
 Template: live-debconfig/ifupdown/nameserver-addresses
 Type: string
 Default: