Unverified Commit 242146d9 by Serge Hallyn Committed by GitHub

Merge pull request #1932 from 3XX0/dhclient-hook

hooks: add dhclient hooks
parents 29a01248 27234deb
......@@ -136,6 +136,8 @@ doc/manpage.refs
doc/api/html/*
hooks/unmount-namespace
hooks/dhclient-start
hooks/dhclient-stop
m4/
......
......@@ -889,6 +889,8 @@ AC_CONFIG_FILES([
doc/ko/see_also.sgml
hooks/Makefile
hooks/dhclient-start
hooks/dhclient-stop
templates/Makefile
templates/lxc-alpine
......
......@@ -5,6 +5,9 @@ hooks_SCRIPTS = \
clonehostname \
mountecryptfsroot \
ubuntu-cloud-prep \
dhclient-script \
dhclient-start \
dhclient-stop \
squid-deb-proxy-client
binhooks_PROGRAMS = \
......
#! /bin/bash
set -e
LXC_HOOK_DIR="@LXCHOOKDIR@"
rootfs="${LXC_ROOTFS_PATH##*:}"
pidfile="${rootfs%/*}/dhclient.pid"
mkdir -p "${rootfs}/var/lib/dhclient"
nsenter -u -U -n -t "${LXC_PID}" -- \
/sbin/dhclient -nw -1 -pf ${pidfile} -lf ${rootfs}/var/lib/dhclient/dhclient.leases -e ROOTFS=${rootfs} -sf ${LXC_HOOK_DIR}/dhclient-script
#! /bin/bash
set -e
LXC_HOOK_DIR="@LXCHOOKDIR@"
rootfs="${LXC_ROOTFS_PATH##*:}"
pidfile="${rootfs%/*}/dhclient.pid"
# XXX Stop hook namespace arguments are wrong for some reason, those are the host namespaces not the container ones.
# Retrieve the namespaces from the dhclient pidfile instead.
nsenter -u -U -n -t $(< ${pidfile}) -- \
/sbin/dhclient -r -pf ${pidfile} -lf ${rootfs}/var/lib/dhclient/dhclient.leases -e ROOTFS=${rootfs} -sf ${LXC_HOOK_DIR}/dhclient-script
rm -f ${pidfile}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment