summaryrefslogtreecommitdiff
path: root/scripts/add_bootfile_eth_hwid
diff options
context:
space:
mode:
authorrbalocca <rbalocca@fugazi.vyatta.com>2007-12-18 14:18:21 -0800
committerrbalocca <rbalocca@fugazi.vyatta.com>2007-12-18 14:18:21 -0800
commit7a4610e0fb11946ba40ac1fe1eafbddd39a15e48 (patch)
tree7f9dace2de1c4881b2cbbaa7e36fbf61c74bf8eb /scripts/add_bootfile_eth_hwid
parent94fbe9b07d0f556fcd2d9bcb3b7e00a1fb2df16b (diff)
parentc30fc4752c878c12255101aa928c64f7a3511020 (diff)
downloadvyatta-cfg-quagga-7a4610e0fb11946ba40ac1fe1eafbddd39a15e48.tar.gz
vyatta-cfg-quagga-7a4610e0fb11946ba40ac1fe1eafbddd39a15e48.zip
Merge branch 'master' into glendale
Diffstat (limited to 'scripts/add_bootfile_eth_hwid')
-rwxr-xr-xscripts/add_bootfile_eth_hwid30
1 files changed, 30 insertions, 0 deletions
diff --git a/scripts/add_bootfile_eth_hwid b/scripts/add_bootfile_eth_hwid
new file mode 100755
index 00000000..2a9cc69c
--- /dev/null
+++ b/scripts/add_bootfile_eth_hwid
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+# add ethnet interface sub-block to configure file
+
+shopt -s extglob
+
+if [[ "$*" == *--help* ]] ; then
+ echo ${0##*/} [test_]FILE INTERFACE HWID
+ exit 0
+fi
+
+if [[ "$1" == test_* ]] ; then
+ origfile=$1
+ bootfile=/tmp/${1##*/}_$$
+ cp $origfile $bootfile
+ trap "diff -c $origfile $bootfile; rm -f $bootfile; exit 0" $?
+else
+ origfile=
+ bootfile=$1
+fi
+eth=$2
+hwid=$3
+
+sed -i '/^interfaces {$/,/^}$/ {
+ /^}$/i\
+ ethernet '"$eth"' {\
+ hw-id: '"$hwid"'\
+ link-detect\
+ }
+ }' $bootfile