-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathget-dhcpv6.sh
executable file
·60 lines (49 loc) · 1.22 KB
/
get-dhcpv6.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
# Get interface as first argument
interface="$1"
if [ "$interface" = "" ]; then
echo Syntax: $0 interface 1>&2
exit
fi
# Configure using DHCPv6
if [ "$managed_conf" = "1" ]; then
echo TODO FIXME HELP I am not configuring with a managed configuration
while read line; do
# Outer echo is for stripping whitespace
key=$(echo $(echo $line|cut -d: -f1))
value=$(echo $(echo $line|cut -d: -f2-))
echo $key=$value
# Strip the last 3 chars
key=$(echo $key|sed 's/...$//')
case $key in
"nameserver")
nameservers+=" $value"
;;
default)
echo TODO FIXME HELP I do not understand $key=$value
esac
done << EOF
$(dhcp6c -i $interface)
EOF
fi
# Grab additional information from DHCPv6
if [ "$other_conf" = 1 ]; then
while read line; do
# Outer echo is for stripping whitespace
key=$(echo $(echo $line|cut -d: -f1))
value=$(echo $(echo $line|cut -d: -f2-))
echo TODO something with $key=$value
# Strip the last 3 chars
key=$(echo $key|sed 's/...$//')
case $key in
"nameserver")
nameservers+=" $value"
;;
default)
echo TODO FIXME HELP I do not understand $key=$value
esac
done << EOF
$(dhcp6c -i $interface)
EOF
fi
echo nameservers=$(echo $nameservers)