Commit 91a5df88 by Serge Hallyn Committed by Stéphane Graber

try to better handle out of date container caches.

For a lucid container, apt-get update before installing the source package for add-apt-repository, so that apt-get does not fail. If apt-get dist-upgrade fails, suggest running lxc-create with -F. Signed-off-by: 's avatarSerge Hallyn <serge.hallyn@ubuntu.com>
parent 1bd051a6
...@@ -152,6 +152,12 @@ cleanup() ...@@ -152,6 +152,12 @@ cleanup()
rm -rf $cache/rootfs-$arch rm -rf $cache/rootfs-$arch
} }
suggest_flush()
{
echo "Container upgrade failed. The container cache may be out of date,"
echo "in which case flushing the case (see -F in the hep output) may help."
}
download_ubuntu() download_ubuntu()
{ {
cache=$1 cache=$1
...@@ -199,15 +205,9 @@ exit 101 ...@@ -199,15 +205,9 @@ exit 101
EOF EOF
chmod +x "$1/partial-${arch}"/usr/sbin/policy-rc.d chmod +x "$1/partial-${arch}"/usr/sbin/policy-rc.d
lxc-unshare -s MOUNT -- chroot "$1/partial-${arch}" apt-get dist-upgrade -y lxc-unshare -s MOUNT -- chroot "$1/partial-${arch}" apt-get dist-upgrade -y || { suggest_flush; false; }
ret=$?
rm -f "$1/partial-${arch}"/usr/sbin/policy-rc.d rm -f "$1/partial-${arch}"/usr/sbin/policy-rc.d
if [ $ret -ne 0 ]; then
echo "Failed to upgrade the cache"
return 1
fi
chroot "$1/partial-${arch}" apt-get clean chroot "$1/partial-${arch}" apt-get clean
mv "$1/partial-$arch" "$1/rootfs-$arch" mv "$1/partial-$arch" "$1/rootfs-$arch"
...@@ -472,6 +472,7 @@ post_process() ...@@ -472,6 +472,7 @@ post_process()
# for lucid, if not trimming, then add the ubuntu-virt # for lucid, if not trimming, then add the ubuntu-virt
# ppa and install lxcguest # ppa and install lxcguest
if [ $release = "lucid" ]; then if [ $release = "lucid" ]; then
chroot $rootfs apt-get update
chroot $rootfs apt-get install --force-yes -y python-software-properties chroot $rootfs apt-get install --force-yes -y python-software-properties
chroot $rootfs add-apt-repository ppa:ubuntu-virt/ppa chroot $rootfs add-apt-repository ppa:ubuntu-virt/ppa
fi fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment