Merge "Make the finalise_base function less Ubuntu-ish."

This commit is contained in:
Jenkins 2013-06-19 22:17:45 +00:00 committed by Gerrit Code Review
commit a3fc33dc77

View File

@ -69,13 +69,8 @@ function create_base () {
# Configure Image # Configure Image
# Setup resolv.conf so we can chroot to install some packages # Setup resolv.conf so we can chroot to install some packages
# XXXX: Should store the old state rather than unlink; then restore later. if [ -L $TMP_MOUNT_PATH/etc/resolv.conf ] || [ -f $TMP_MOUNT_PATH/etc/resolv.conf ] ; then
if [ -L $TMP_MOUNT_PATH/etc/resolv.conf ] ; then sudo mv $TMP_MOUNT_PATH/etc/resolv.conf $TMP_MOUNT_PATH/etc/resolv.conf.ORIG
sudo unlink $TMP_MOUNT_PATH/etc/resolv.conf
fi
if [ -f $TMP_MOUNT_PATH/etc/resolv.conf ] ; then
sudo rm -f $TMP_MOUNT_PATH/etc/resolv.conf
fi fi
# Recreate resolv.conf # Recreate resolv.conf
@ -136,10 +131,12 @@ function prepare_first_boot () {
function finalise_base () { function finalise_base () {
TARGET_ROOT=$TMP_MOUNT_PATH run_d cleanup TARGET_ROOT=$TMP_MOUNT_PATH run_d cleanup
# Now remove the resolv.conf we created above # Remove the resolv.conf we created above
sudo rm -f $TMP_MOUNT_PATH/etc/resolv.conf sudo rm -f $TMP_MOUNT_PATH/etc/resolv.conf
# The we need to recreate it as a link # Move the original back
sudo ln -sf ../run/resolvconf/resolv.conf $TMP_MOUNT_PATH/etc/resolv.conf if [ -L $TMP_MOUNT_PATH/etc/resolv.conf.ORIG ] || [ -f $TMP_MOUNT_PATH/etc/resolv.conf.ORIG ] ; then
sudo mv $TMP_MOUNT_PATH/etc/resolv.conf.ORIG $TMP_MOUNT_PATH/etc/resolv.conf
fi
} }
function compress_image () { function compress_image () {