Debian Codegraph @

debian/examples/arping.if-up

raw
1 #!/bin/sh
2 set -e
3
4 if [ "${IF_ADDRESS}" = "" ] ; then
5 exit 0
6 fi
7
8 . /lib/lsb/init-functions
9
10 IPUP=0
11 DOWN=0
12
13 if [ -f /etc/default/arping ] ; then
14 . /etc/default/arping
15 fi
16
17 if [ $IPUP = 0 ]; then
18 exit 0
19 fi
20
21 log_action_begin_msg "Using arping to check duplicity of ${IF_ADDRESS}"
22
23 if arping -c 1 -d -I ${IFACE} ${IF_ADDRESS} > /dev/null ; then
24 if [ $DOWN = 1 ]; then
25 ifconfig ${IFACE} down
26 msg="Bringing ${IFACE} down. "
27 fi
28 msg=${msg}"Another computer is already using ${IF_ADDRESS}"
29 status=1
30 else
31 msg="No duplicates found"
32 status=0
33 fi
34
35 log_action_end_msg ${status} "${msg}"
36
37 [ ${status} = 0 ]