mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-05-02 18:13:40 +00:00

This hook script updates the hostname in various files under /etc in the cloned container. In order to do so, the old container name is passed in the LXC_SRC_NAME environment variable. Signed-off-by: Dwight Engen <dwight.engen@oracle.com> Acked-by: Stéphane Graber <stgraber@ubuntu.com> Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
30 lines
1012 B
Bash
Executable File
30 lines
1012 B
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# Update the hostname in the cloned container's scripts
|
|
#
|
|
# Copyright © 2013 Oracle.
|
|
#
|
|
# This library is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License version 2, as
|
|
# published by the Free Software Foundation.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License along
|
|
# with this program; if not, write to the Free Software Foundation, Inc.,
|
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
# Note that /etc/hostname is updated by lxc itself
|
|
for file in \
|
|
$LXC_ROOTFS_PATH/etc/sysconfig/network \
|
|
$LXC_ROOTFS_PATH/etc/sysconfig/network-scripts/ifcfg-* ;
|
|
do
|
|
if [ -f $file ]; then
|
|
sed -i "s|$LXC_SRC_NAME|$LXC_NAME|" $file
|
|
fi
|
|
done
|
|
exit 0
|