"Inital commit to Gerrit"
[profile/ivi/dhcp.git] / contrib / dhcp.spec
1 Summary: The Internet Systems Consortium (ISC) DHCP server
2 Name: dhcp
3 %define version 3.0.2
4 Version: %{version}
5 Release: 2tac
6 Group: System Environment/Daemons
7 Source: /usr/local/src/RPM/SOURCES/dhcp-%{version}.tar.gz
8 Copyright: ISC
9 BuildRoot: /var/tmp/dhcp-%{version}-root
10
11 %description
12 Dhcp includes the DHCP server which is used for dynamically configuring
13 hosts on a network.  Host configuration items such as IP address, name
14 servers, domain name, etc. can all be retrieved from the DHCP server by
15 a DHCP client.  This eases the burden of network wide configuration by
16 putting all of the configuration into one place.
17
18 %package client
19 Summary: A DHCP client
20 Group: System Environment/Configuration
21
22 %description client
23 Dhcp client is a DHCP client for various UNIX operating systems. It allows
24 a UNIX machine to obtain it's networking parameters from a DHCP server.
25
26 %package relay
27 Summary: A DHCP relay
28 Group: System Environment/Daemons
29
30 %description relay
31 Dhcp relay is a relay agent for DHCP packets.  It is used on a subnet with
32 DHCP clients to "relay" their requests to a subnet that has a DHCP server
33 on it.  Because DHCP packets can be broadcast, they will not be routed off
34 of the local subnet.  The DHCP relay takes care of this for the client.
35
36 %package devel
37 Summary: Development headers and libraries for the dhcpctl API
38 Group: Development/Libraries
39
40 %description devel
41 Dhcp devel contains all of the libraries and headers for developing with
42 the dhcpctl API.
43
44 %prep
45 %setup -q -n dhcp-%{version}
46 # do some file editing
47 egrep "VARRUN
48 ETC
49 VARDB" site.conf | sed -e 's/ *=/=/g' -e 's/= */=/g' > vars
50 . ./vars
51 cat << EOF >> includes/site.h
52 #define _PATH_DHCPD_PID         "$VARRUN/dhcpd.pid"
53 #define _PATH_DHCPD_DB          "$ETC/dhcpd.leases"
54 #define _PATH_DHCPD_CONF        "$ETC/dhcpd.conf"
55 EOF
56 ./configure --with-nsupdate
57
58 %build
59 make
60
61 %install
62 rm -rf $RPM_BUILD_ROOT
63 mkdir -p $RPM_BUILD_ROOT/usr/local/sbin
64
65 make DESTDIR="$RPM_BUILD_ROOT" install
66
67 %ifos linux
68 mkdir -p ${RPM_BUILD_ROOT}/etc/rc.d/{init,rc0,rc1,rc2,rc3,rc4,rc5,rc6}.d
69 install -m 755 linux.init ${RPM_BUILD_ROOT}/etc/rc.d/init.d/dhcpd
70 %else
71 %ifos solaris
72 mkdir -p ${RPM_BUILD_ROOT}/etc/init.d
73 sed -e s'|@PREFIX@|%{_prefix}|g' < contrib/solaris.init > ${RPM_BUILD_ROOT}/etc/init.d/dhcpd
74 chmod 755 ${RPM_BUILD_ROOT}/etc/init.d/dhcpd
75 %endif
76 %endif
77
78 # strip binaries and libraries
79 strip $RPM_BUILD_ROOT%{_prefix}/sbin/* || :
80 for i in `find $RPM_BUILD_ROOT/ -type 'f' -perm '+a=x' ! -name 'lib*so*'`; do
81         file $i |grep -q "not stripped" && strip $i
82 done
83
84 %post
85 %ifos linux
86     /sbin/chkconfig --add dhcpd
87     /etc/rc.d/init.d/dhcpd start
88 %else
89     %ifos solaris
90         ln /etc/init.d/dhcpd /etc/rc2.d/S90dhcpd
91         ln /etc/init.d/dhcpd /etc/rc0.d/K30dhcpd
92         /etc/init.d/dhcpd start
93     %else
94         echo "Unknown O/S.  You will need to manually configure your\nsystem"
95         echo "to start the DHCP server on system startup."
96     %endif
97 %endif
98
99 %preun
100 if [ $1 = 0 ]; then
101     %ifos linux
102         /etc/rc.d/init.d/dhcpd stop
103         /sbin/chkconfig --del dhcpd
104     %else
105         %ifos solaris
106             /etc/init.d/dhcpd stop
107             rm /etc/rc2.d/S90dhcpd
108             rm /etc/rc0.d/K30dhcpd
109         %else
110             echo "Unknown O/S.  You will need to manually clean up the DHCP"
111             echo "server startup\n in your system startup environment."
112         %endif
113     %endif
114 fi
115
116 %clean
117 rm -rf $RPM_BUILD_ROOT
118
119 %files
120 %defattr(-,root,root)
121 %doc COPYRIGHT DOCUMENTATION ISC-LICENSE CHANGES README RELNOTES doc/*
122
123 %{_prefix}/sbin/dhcpd
124 %{_prefix}/man/cat1m/dhcpd.1m
125 %{_prefix}/man/cat4/dhcpd.conf.4
126 %{_prefix}/man/cat4/dhcpd.leases.4
127 %{_prefix}/man/cat4/dhcp-options.4
128 %{_prefix}/man/cat4/dhcp-eval.4
129 %{_prefix}/man/cat4/dhcp-contrib.4
130 %ifos linux
131 %config /etc/rc.d/init.d/dhcpd
132 %else
133 %ifos solaris
134 %config /etc/init.d/dhcpd
135 %endif
136 %endif
137
138 %files devel
139 %{_prefix}/man/cat3
140 %{_prefix}/lib
141 %{_prefix}/include
142
143 %files client
144 %{_prefix}/etc/dhclient-script
145 %{_prefix}/sbin/dhclient
146 %{_prefix}/man/cat1m/dhclient.1m
147 %{_prefix}/man/cat1m/dhclient-script.1m
148 %{_prefix}/man/cat4/dhclient.conf.4
149 %{_prefix}/man/cat4/dhclient.leases.4
150
151 %files relay
152 %{_prefix}/sbin/dhcrelay
153 %{_prefix}/man/cat1m/dhcrelay.1m
154
155 %changelog
156 * Fri Oct  1 1999 Brian J. Murrell <brian@interlinx.bc.ca>
157 - write a spec file for dhcpd