]> git.proxmox.com Git - mirror_lxc.git/blame - hooks/dhclient-stop.in
Merge pull request #2048 from duguhaotian/master
[mirror_lxc.git] / hooks / dhclient-stop.in
CommitLineData
27234deb
JC
1#! /bin/bash
2
3set -e
4
5LXC_HOOK_DIR="@LXCHOOKDIR@"
6
7rootfs="${LXC_ROOTFS_PATH##*:}"
8pidfile="${rootfs%/*}/dhclient.pid"
9
10# XXX Stop hook namespace arguments are wrong for some reason, those are the host namespaces not the container ones.
11# Retrieve the namespaces from the dhclient pidfile instead.
12nsenter -u -U -n -t $(< ${pidfile}) -- \
13 /sbin/dhclient -r -pf ${pidfile} -lf ${rootfs}/var/lib/dhclient/dhclient.leases -e ROOTFS=${rootfs} -sf ${LXC_HOOK_DIR}/dhclient-script
14
15rm -f ${pidfile}