|
|
DHCPD_CONF="/etc/dhcp/dhcpd.conf" | DHCPD_CONF="/etc/dhcp/dhcpd.conf" |
| |
# Work out our cffile if it's on our DHCPD_OPTS | # Work out our cffile if it's on our DHCPD_OPTS |
if [[ " ${DHCPD_OPTS} " == *" -cf "* ]]; then |
case " ${DHCPD_OPTS} " in |
DHCPD_CONF=" ${DHCPD_OPTS} " |
*" -cf "*) |
DHCPD_CONF="${DHCPD_CONF##* -cf }" |
DHCPD_CONF=" ${DHCPD_OPTS} " |
DHCPD_CONF="${DHCPD_CONF%% *}" |
DHCPD_CONF="${DHCPD_CONF##* -cf }" |
|
DHCPD_CONF="${DHCPD_CONF%% *}" |
# Now we have the cffile, we can remove it from our options |
# Now we have the cffile, we can remove it from our options |
DHCPD_OPTS="${DHCPD_OPTS//-cf/}" |
DHCPD_OPTS="`echo ${DHCPD_OPTS} | sed 's/-cf//; s/""${DHCPD_CONF}""//'` |
DHCPD_OPTS="${DHCPD_OPTS//${DHCPD_CONF}/}" |
;; |
fi |
esac |
| |
depend() { | depend() { |
need net | need net |
|
|
} | } |
| |
start() { | start() { |
if [[ ! -f "${DHCPD_CHROOT}/${DHCPD_CONF}" ]] ; then |
if [ ! -f "${DHCPD_CHROOT}/${DHCPD_CONF}" ] ; then |
eerror "${DHCPD_CHROOT}/${DHCPD_CONF} does not exist" | eerror "${DHCPD_CHROOT}/${DHCPD_CONF} does not exist" |
return 1 | return 1 |
fi | fi |
| |
local leasefile="$(get_var lease-file-name)" | local leasefile="$(get_var lease-file-name)" |
leasefile="${DHCPD_CHROOT}/${leasefile:-/var/lib/dhcp/dhcpd.leases}" | leasefile="${DHCPD_CHROOT}/${leasefile:-/var/lib/dhcp/dhcpd.leases}" |
if [[ ! -f ${leasefile} ]] ; then |
if [ ! -f ${leasefile} ] ; then |
ebegin "Creating ${leasefile}" | ebegin "Creating ${leasefile}" |
touch "${leasefile}" | touch "${leasefile}" |
chown dhcp:dhcp "${leasefile}" | chown dhcp:dhcp "${leasefile}" |
|
|
fi | fi |
| |
# Setup LD_PRELOAD so name resolution works in our chroot. | # Setup LD_PRELOAD so name resolution works in our chroot. |
if [[ -n ${DHCPD_CHROOT} ]] ; then |
if [ -n "${DHCPD_CHROOT}" ] ; then |
LD_PRELOAD="${LD_PRELOAD} /usr/lib/libresolv.so" | LD_PRELOAD="${LD_PRELOAD} /usr/lib/libresolv.so" |
export LD_PRELOAD="${LD_PRELOAD} /usr/lib/libnss_dns.so" | export LD_PRELOAD="${LD_PRELOAD} /usr/lib/libnss_dns.so" |
fi | fi |