]> git.proxmox.com Git - mirror_lxc.git/blob - hooks/clonehostname
Merge pull request #2842 from brauner/2019-02-11/fix_licensing
[mirror_lxc.git] / hooks / clonehostname
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
21 for file in \
22 $LXC_ROOTFS_MOUNT/etc/sysconfig/network \
23 $LXC_ROOTFS_MOUNT/etc/sysconfig/network-scripts/ifcfg-* \
24 $LXC_ROOTFS_MOUNT/etc/hosts ;
25 do
26 if [ -f $file ]; then
27 sed -i "s|$LXC_SRC_NAME|$LXC_NAME|" $file
28 fi
29 done
30 exit 0