f1d096d95a
Since we already have a wrapper script for enabling services called os-svc-enable, drop all direct usage of systemctl enable, replacing it with os-svc-enable. Also drive-by replacements of == with =. == is a pattern match. Change-Id: I707bf6f02207308e8f61caff17a27b0697096359
65 lines
1.6 KiB
Bash
Executable File
65 lines
1.6 KiB
Bash
Executable File
#!/bin/bash
|
|
set -eux
|
|
|
|
install-packages dnsmasq dnsmasq-utils
|
|
|
|
function install_dnsmasq_upstart() {
|
|
cat > /etc/init/nova-bm-dnsmasq.conf << eof
|
|
start on runlevel [2345]
|
|
stop on runlevel [016]
|
|
pre-start script
|
|
mkdir -p /tftpboot
|
|
chown -R nova:nova /tftpboot
|
|
killall -9 dnsmasq || echo 'no dnsmasq running'
|
|
end script
|
|
|
|
respawn
|
|
respawn limit 2 5
|
|
|
|
script
|
|
exec dnsmasq --conf-file= \\
|
|
--keep-in-foreground \\
|
|
--port=0 \\
|
|
--dhcp-boot=pxelinux.0 \\
|
|
--bind-interfaces \\
|
|
--pid-file=/var/run/dnsmasq.pid \\
|
|
--interface=br-ctlplane \\
|
|
--dhcp-range=192.0.2.65,192.0.2.69,29
|
|
end script
|
|
post-start exec sleep 1
|
|
eof
|
|
}
|
|
|
|
function install_dnsmasq_systemd() {
|
|
cat > /lib/systemd/system/nova-bm-dnsmasq.service << eof
|
|
[Unit]
|
|
Description=Nova dnsmasq service
|
|
After=openvswitch.service
|
|
|
|
[Service]
|
|
Type=forking
|
|
ExecStartPre=-/bin/killall -9 dnsmasq
|
|
ExecStart=/sbin/dnsmasq --conf-file= \\
|
|
--port=0 \\
|
|
--enable-tftp \\
|
|
--tftp-root=/tftpboot \\
|
|
--dhcp-boot=pxelinux.0 \\
|
|
--bind-interfaces \\
|
|
--pid-file=/var/run/dnsmasq.pid \\
|
|
--interface=br-ctlplane \\
|
|
--dhcp-range=192.0.2.65,192.0.2.69,29
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
Alias=nova-bm-dnsmasq.service
|
|
eof
|
|
|
|
}
|
|
|
|
if [ "$DIB_INIT_SYSTEM" = "upstart" ]; then
|
|
install_dnsmasq_upstart
|
|
elif [ "$DIB_INIT_SYSTEM" = "systemd" ]; then
|
|
install_dnsmasq_systemd
|
|
fi
|
|
os-svc-enable -n nova-bm-dnsmasq
|