From: Matty Date: Wed, 24 Jun 2009 11:13:18 +0000 (+0200) Subject: lxc-fedora fixes X-Git-Tag: lxc_0_6_3~40 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4f3f0d4b015af0b1021e22dd3b6a5f2fffbff0d2;p=thirdparty%2Flxc.git lxc-fedora fixes Howdy, I was playing around with LXC containers this past weekend, and noticed a couple of issues with the lxc-fedora script: #1: Line 96 should be ${ROOTFS}/etc/sysconfig/network instead of ${ROOTFS}/sysconfig/network #2 Line 249 contains a reference to $PKG, which isn't used in the program. I adjusted the variable to point to the correct package, and use this in the calls to yumdownloader: PKG="${DISTRO}-release.noarch.rpm" ..... yumdownloader --destdir="${CACHE}/partial" "${PKG}" #3 The $CACHE/partial path is escaped unnecessarily: RPM="rpm --root \"${CACHE}/partial\"" #4 The program assumes yumdownloader will work, which isn't always the case. I added an if statement to check the return code: echo "Downloading distribution release file ${PKG}" yumdownloader --destdir="${CACHE}/partial" "${PKG}" RESULT=$? if [ "${RESULT}" != "0" ]; then echo "Enable to download the distribution release file" exit 1 fi #5 The package name passed to yumdownloader is incorrect: yumdownloader --destdir="${CACHE}/partial" "${DISTRO}-release.noarch.rpm" On Fedora 10 and 11, this evaluates to: fedora-release.noarch.rpm When we need it to evaluate to: fedora-{RELEASE_VER}.release.noarch This is fixed in the PKG variable listed above. A patch that addresses these issues is attached. Thanks, - Ryan Signed-off-by: Matty Signed-off-by: Daniel Lezcano --- diff --git a/scripts/lxc-fedora.in b/scripts/lxc-fedora.in index 821f5b3ea..54d7c746b 100644 --- a/scripts/lxc-fedora.in +++ b/scripts/lxc-fedora.in @@ -93,7 +93,7 @@ EOF # custom hostname write_distro_hostname() { -cat < ${ROOTFS}/sysconfig/network +cat < ${ROOTFS}/etc/sysconfig/network NETWORKING=yes HOSTNAME=${UTSNAME} EOF @@ -246,14 +246,23 @@ create() { '/^Release/ { release = $2 } /^Version/ { version = $2 } END { print version "-" release }')" - PKG="${DISTRO}-release.noarch.rpm" - RPM="rpm --root \"${CACHE}/partial\"" + + PKG="${DISTRO}-release-${RELEASE}.noarch" + RPM="rpm --root ${CACHE}/partial" echo "Initializing RPM cache ..." ${RPM} --initdb - echo "Downloading ${DISTRO} Release ${RELEASE} description ..." - yumdownloader --destdir="${CACHE}/partial" "${DISTRO}-release.noarch.rpm" && \ - ${RPM} --nodeps -ihv "${CACHE}/partial/${DISTRO}-release*.noarch.rpm" + echo "Downloading distribution release file ${PKG}" + yumdownloader --destdir="${CACHE}/partial" "${PKG}" + RESULT=$? + + if [ "${RESULT}" != "0" ]; then + echo "Enable to download the distribution release file" + exit 1 + fi + + ${RPM} --nodeps -ihv "${CACHE}/partial/${PKG}.rpm" + echo "Downloading ${DISTRO} minimal ..." yum --installroot="${CACHE}/partial" -y groupinstall Base RESULT=$?