clonehostname revision 5b99af0079813347d90c935ea540ed7f96dcea38
2454dfa32c93c20a8522c6ed42fe057baaac9f9aStephan Bosch#!/bin/sh
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen#
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen# Update the hostname in the cloned container's scripts
16f816d3f3c32ae3351834253f52ddd0212bcbf3Timo Sirainen#
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainen# Copyright © 2013 Oracle.
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainen#
58be9d6bcc3800f5b3d76a064ee767fbe31a5a8aTimo Sirainen# This library is free software; you can redistribute it and/or modify
1098fc409a45e7603701dc94635927a673bee0c1Timo Sirainen# it under the terms of the GNU General Public License version 2, as
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen# published by the Free Software Foundation.
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen#
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen# This program is distributed in the hope that it will be useful,
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen# but WITHOUT ANY WARRANTY; without even the implied warranty of
e9594e86dc601b72c1636f2b901dcfbf4ffaf47fAki Tuomi# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen# GNU General Public License for more details.
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen#
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen# You should have received a copy of the GNU General Public License along
ab1e5b156d1b5480d36ed6e8e06197339d803038Timo Sirainen# with this program; if not, write to the Free Software Foundation, Inc.,
ab1e5b156d1b5480d36ed6e8e06197339d803038Timo Sirainen# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen# Note that /etc/hostname is updated by lxc itself
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenfor file in \
e8fd7988ec183fb6c104aed19a61f1a096c51d34Timo Sirainen $LXC_ROOTFS_PATH/etc/sysconfig/network \
e8fd7988ec183fb6c104aed19a61f1a096c51d34Timo Sirainen $LXC_ROOTFS_PATH/etc/sysconfig/network-scripts/ifcfg-* \
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen $LXC_ROOTFS_PATH/etc/hosts ;
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainendo
6bc0f424bcdb9119d8159874cf98adfa53eefd9aTimo Sirainen if [ -f $file ]; then
6bc0f424bcdb9119d8159874cf98adfa53eefd9aTimo Sirainen sed -i "s|$LXC_SRC_NAME|$LXC_NAME|" $file
fafa6393128960c70a9979af1c23cea41027fdd1Josef 'Jeff' Sipek fi
0b2c958d1cdcbeb46c2ce7ada0917b304ad89dc1Timo Sirainendone
6bc0f424bcdb9119d8159874cf98adfa53eefd9aTimo Sirainenexit 0
6bc0f424bcdb9119d8159874cf98adfa53eefd9aTimo Sirainen