]> git.proxmox.com Git - mirror_lxc.git/blame - hooks/clonehostname
Merge pull request #3039 from brauner/master
[mirror_lxc.git] / hooks / clonehostname
CommitLineData
1143ed39
DE
1#!/bin/sh
2#
3# Update the hostname in the cloned container's scripts
4#
5# Copyright © 2013 Oracle.
6#
7# This library is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License version 2, as
9# published by the Free Software Foundation.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License along
17# with this program; if not, write to the Free Software Foundation, Inc.,
18# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20# Note that /etc/hostname is updated by lxc itself
21for file in \
cd85f31e
MK
22 $LXC_ROOTFS_MOUNT/etc/sysconfig/network \
23 $LXC_ROOTFS_MOUNT/etc/sysconfig/network-scripts/ifcfg-* \
24 $LXC_ROOTFS_MOUNT/etc/hosts ;
1143ed39
DE
25do
26 if [ -f $file ]; then
27 sed -i "s|$LXC_SRC_NAME|$LXC_NAME|" $file
28 fi
29done
30exit 0