From 4dac5d4e8002d0e349caf84eb7d7206dd4078e09 Mon Sep 17 00:00:00 2001 From: Mohamed Larabi Date: Fri, 1 Feb 2013 18:12:37 +0100 Subject: [PATCH] fix handling of lxc version and other fixes.. in vbuild-init-lxc --- vbuild-init-lxc.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/vbuild-init-lxc.sh b/vbuild-init-lxc.sh index 911ea5d6..5105cd42 100755 --- a/vbuild-init-lxc.sh +++ b/vbuild-init-lxc.sh @@ -151,7 +151,7 @@ function prepare_host() { #retrieve and install lxc from sources raw_version=$(lxc-version ||: ) lxc_installed_version=$(echo $raw_version | sed -e 's,.*: ,,') - if [ "$lxc_installed_version" != "$lxc_version" ] ; then + if [ "$lxc_installed_version" != "$(echo $lxc_version | cut -d'-' -f2)" ] ; then echo "Expecting version" '['$lxc_version']' echo "Found version" '['$lxc_installed_version']' echo "Installing lxc ..." @@ -208,7 +208,7 @@ MTU=1500 EOF # set the hostname -if [ "fcdistro" == "f18"]; then +if [[ "$fcdistro" == "f18" ]] ; then cat < ${rootfs_path}/etc/hostname $HOSTNAME EOF @@ -257,8 +257,6 @@ 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 } @@ -271,9 +269,6 @@ 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() { @@ -598,7 +593,12 @@ function setup_lxc() { done [ -z $ssh_up ] && echo "SSHD in container $lxc is not running" - + + # set hostname for fedora18 + if [[ "$fcdistro" == "f18" ]] ; then + echo $HOSTNAME + #ssh -o "StrictHostKeyChecking no" $IP "hostnamectl set-hostname '$HOSTNAME'" + fi # rpm --rebuilddb chroot $rootfs_path rpm --rebuilddb -- 2.43.0