manage f18 hostname setting in vbuild-init-lxc.sh
authorMohamed Larabi <mohamed.larabi@inria.fr>
Fri, 1 Feb 2013 15:46:40 +0000 (16:46 +0100)
committerMohamed Larabi <mohamed.larabi@inria.fr>
Fri, 1 Feb 2013 15:46:40 +0000 (16:46 +0100)
vbuild-init-lxc.sh

index ed14021..911ea5d 100755 (executable)
@@ -208,10 +208,16 @@ MTU=1500
 EOF
 
 # set the hostname
+if [ "fcdistro" == "f18"]; then
+    cat <<EOF > ${rootfs_path}/etc/hostname
+$HOSTNAME
+EOF
+else
     cat <<EOF > ${rootfs_path}/etc/sysconfig/network
 NETWORKING=yes
 HOSTNAME=$HOSTNAME
 EOF
+fi
 
     # set minimal hosts
 #    cat <<EOF > $rootfs_path/etc/hosts
@@ -251,6 +257,8 @@ function configure_fedora_init() {
     sed -i 's|.sbin.start_udev||' ${rootfs_path}/etc/rc.d/rc.sysinit
     chroot ${rootfs_path} chkconfig udev-post off
     chroot ${rootfs_path} chkconfig network on
+    if [ "fcdistro" == "f18"]; then 
+       chroot ${rootfs_path} hostnamectl set-hostname $HOSTNAME
 }
 
 
@@ -263,6 +271,9 @@ function configure_fedora_systemd() {
     #dependency on a device unit fails it specially that we disabled udev
     sed -i 's/After=dev-%i.device/After=/' ${rootfs_path}/lib/systemd/system/getty\@.service
     chroot ${rootfs_path} chkconfig network on
+    if [ "fcdistro" == "f18"]; then
+       chroot ${rootfs_path} hostnamectl set-hostname $HOSTNAME
+    fi
 }
 
 function download_fedora() {