+#----------------------------------------------------------------------
+# De-activate all volume groups and switch to new dm-only LVM config.
+log deactivating volume groups
+
+vgchange -a n
+mv /etc/lvm/lvm.conf /etc/lvm/lvm.conf.old
+mv /etc/lvm/lvm.conf.new /etc/lvm/lvm.conf
+rm -f /etc/lvm/cache/.cache
+
+# Snapshot the block devices.
+for d in $devices_to_send; do
+ snap_name $d
+ log snapshotting block device /dev/$d to $dname ...
+
+ snapshot $d $dname
+
+ # The block devices are whole disks. Use kpartx to repartition them.
+ log running kpartx -a /dev/mapper/$dname ...
+ kpartx -a /dev/mapper/$dname
+done
+
+# Rescan for LVs.
+log running vgscan
+vgscan
+vgchange -a y
+
+# Mount the root filesystem on /mnt/root. If it's a physical
+# device then we want to mount (eg) /dev/mapper/snap_sda2.
+# If it's a LVM device then we can just mount the LVM partition.
+
+log mount $root_filesystem as /mnt/root
+
+snap_name $root_filesystem
+root_filesystem_dname="$dname"
+
+if [ -b /dev/mapper/$root_filesystem_dname ]; then
+ mount /dev/mapper/$root_filesystem_dname /mnt/root
+else
+ mount /dev/$root_filesystem /mnt/root
+fi
+
+#----------------------------------------------------------------------
+# Now see if we can get a network configuration.
+log network configuration $network
+
+case "$network" in
+ sh)
+ echo "Network configuration"
+ echo
+ echo "Please configure the network from this shell."
+ echo
+ echo "When finished, exit with ^D or exit"
+ echo
+ shell
+ ;;
+
+ ask)
+ # XXX Not implemented
+ echo "Sorry, we didn't implement this one yet."
+ shell
+ ;;
+
+ auto)
+ echo "Trying to auto-configure network from root filesystem ..."
+ echo
+ if ! auto_network; then
+ echo "Auto-configuration failed. Starting a shell."
+ echo
+ shell
+ fi
+esac