|
1 ## |
|
2 ## arpd.spec -- OpenPKG RPM Package Specification |
|
3 ## Copyright (c) 2000-2008 OpenPKG Foundation e.V. <http://openpkg.net/> |
|
4 ## |
|
5 ## Permission to use, copy, modify, and distribute this software for |
|
6 ## any purpose with or without fee is hereby granted, provided that |
|
7 ## the above copyright notice and this permission notice appear in all |
|
8 ## copies. |
|
9 ## |
|
10 ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED |
|
11 ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
|
12 ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
|
13 ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR |
|
14 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
15 ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
16 ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
|
17 ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
|
18 ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
|
19 ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
|
20 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
|
21 ## SUCH DAMAGE. |
|
22 ## |
|
23 |
|
24 # package information |
|
25 Name: arpd |
|
26 Summary: Address Resolution Protocol (ARP) Reply Daemon |
|
27 URL: http://www.honeyd.org/tools.php |
|
28 Vendor: Niels Provos, Dug Song |
|
29 Packager: OpenPKG Foundation e.V. |
|
30 Distribution: OpenPKG Community |
|
31 Class: EVAL |
|
32 Group: Mapping |
|
33 License: GNU |
|
34 Version: 0.2 |
|
35 Release: 20080101 |
|
36 |
|
37 # package options |
|
38 %option with_fsl yes |
|
39 |
|
40 # list of sources |
|
41 Source0: http://www.citi.umich.edu/u/provos/honeyd/arpd-%{version}.tar.gz |
|
42 Source1: rc.arpd |
|
43 Source2: fsl.arpd |
|
44 Patch0: arpd.patch |
|
45 |
|
46 # build information |
|
47 Prefix: %{l_prefix} |
|
48 BuildRoot: %{l_buildroot} |
|
49 BuildPreReq: OpenPKG, openpkg >= 20060823, libdnet, libpcap, libevent, gcc, make |
|
50 PreReq: OpenPKG, openpkg >= 20060823, libdnet, libpcap, libevent |
|
51 %if "%{with_fsl}" == "yes" |
|
52 BuildPreReq: fsl |
|
53 PreReq: fsl |
|
54 %endif |
|
55 AutoReq: no |
|
56 AutoReqProv: no |
|
57 |
|
58 %description |
|
59 Arpd is an Address Resolution Protocol (ARP) daemon which replies to |
|
60 any ARP request for an IP address matching the specified destination |
|
61 network with the hardware MAC address of the own interface, but only |
|
62 after determining if another host already claims it. Any IP address |
|
63 claimed by arpd is eventually forgotten after a period of inactivity |
|
64 or after a hard timeout, and is relinquished if the real owner shows |
|
65 up. This enables a single host to claim all unassigned addresses on |
|
66 a LAN for network monitoring or simulation. |
|
67 |
|
68 %track |
|
69 prog arpd = { |
|
70 version = %{version} |
|
71 url = http://www.honeyd.org/tools.php |
|
72 regex = arpd-(__VER__)\.tar\.gz |
|
73 } |
|
74 |
|
75 %prep |
|
76 %setup -q -n arpd |
|
77 %patch -p0 |
|
78 %{l_shtool} subst \ |
|
79 -e 's;LIBS=$DNETLIB;LIBS="$LIBS $DNETLIB";' \ |
|
80 -e 's;CFLAGS=$DNETINC;CFLAGS="$CFLAGS $DNETINC";' \ |
|
81 -e 's;net/bpf\.h;pcap-bpf.h;g' \ |
|
82 configure |
|
83 %{l_shtool} subst \ |
|
84 -e 's;/var/run/arpd.pid;%{l_prefix}/var/arpd/arpd.pid;' \ |
|
85 arpd.c arpd.8 |
|
86 |
|
87 %build |
|
88 CC="%{l_cc}" \ |
|
89 CFLAGS="%{l_cflags -O}" \ |
|
90 CPPFLAGS="%{l_cppflags}" \ |
|
91 LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}" \ |
|
92 LIBS="%{l_fsl_libs} -lpcap" \ |
|
93 ./configure \ |
|
94 --prefix=%{l_prefix} \ |
|
95 --with-libdnet=%{l_prefix} \ |
|
96 --with-libpcap=%{l_prefix} \ |
|
97 --with-libevent=%{l_prefix} |
|
98 %{l_make} %{l_mflags} |
|
99 |
|
100 %install |
|
101 rm -rf $RPM_BUILD_ROOT |
|
102 |
|
103 # create directories |
|
104 %{l_shtool} mkdir -f -p -m 755 \ |
|
105 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \ |
|
106 $RPM_BUILD_ROOT%{l_prefix}/var/arpd |
|
107 |
|
108 # install files |
|
109 %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT |
|
110 %{l_shtool} install -c -m 755 %{l_value -s -a} \ |
|
111 %{SOURCE rc.arpd} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ |
|
112 |
|
113 # install OSSP fsl configuration |
|
114 %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl |
|
115 %{l_shtool} install -c -m 644 %{l_value -s -a} \ |
|
116 %{SOURCE fsl.arpd} \ |
|
117 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/ |
|
118 |
|
119 # determine file list |
|
120 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ |
|
121 %{l_files_std} \ |
|
122 '%config %{l_prefix}/etc/fsl/fsl.arpd' \ |
|
123 '%attr(750,%{l_susr},%{l_mgrp}) %{l_prefix}/var/arpd' |
|
124 |
|
125 %files -f files |
|
126 |
|
127 %clean |
|
128 rm -rf $RPM_BUILD_ROOT |
|
129 |
|
130 %pre |
|
131 # before upgrade, save status and stop service |
|
132 [ $1 -eq 2 ] || exit 0 |
|
133 eval `%{l_rc} arpd status 2>/dev/null | tee %{l_tmpfile}` |
|
134 %{l_rc} arpd stop 2>/dev/null |
|
135 exit 0 |
|
136 |
|
137 %post |
|
138 if [ $1 -eq 1 ]; then |
|
139 # display final hints on initial installation |
|
140 ( echo "Before starting ARP daemon, please set the configuration variable" |
|
141 echo "\"arpd_if\" in $RPM_INSTALL_PREFIX/etc/rc.conf to the name of the" |
|
142 echo "used network interface." |
|
143 ) | %{l_rpmtool} msg -b -t notice |
|
144 fi |
|
145 if [ $1 -eq 2 ]; then |
|
146 # after upgrade, restore status |
|
147 eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile} |
|
148 [ ".$arpd_active" = .yes ] && %{l_rc} arpd start |
|
149 fi |
|
150 exit 0 |
|
151 |
|
152 %preun |
|
153 # before erase, stop service and remove log files |
|
154 [ $1 -eq 0 ] || exit 0 |
|
155 %{l_rc} arpd stop 2>/dev/null |
|
156 rm -f $RPM_INSTALL_PREFIX/var/arpd/*.log* >/dev/null 2>&1 || true |
|
157 exit 0 |
|
158 |