/usr/bin/sandbox-test-upgrade is in sandbox-upgrader 0.1+bzr20080818-0ubuntu1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | #!/bin/bash
#
# Copyright (c) 2008 Canonical
#
# Author: Michael Vogt <mvo@ubuntu.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, 51 Franklin Street, Fifth Floor, Boston,
# MA 02111-1301, USA
set -e
VARPATH=/var/lib/sandbox-upgrader/
# configuration
SSHKEY=$VARPATH/ssh/sshkey
SSHHOSTS=$VARPATH/ssh/known_hosts
SSHPORT=51234
RESULTDIR=$VARPATH/result
VNCPORT=localhost:0
# common option for the helpers
KVMOPTS="-no-reboot -m 384 -vnc $VNCPORT -redir tcp:$SSHPORT::22 -net nic,model=virtio -net user "
SSHOPTS="-l root -p $SSHPORT localhost -i $SSHKEY -o StrictHostKeyChecking=no -o UserKnownHostsFile=$SSHHOSTS -o BatchMode=yes -tt -v"
SCPOPTS="-P $SSHPORT -i $SSHKEY -o StrictHostKeyChecking=no -o UserKnownHostsFile=$SSHHOSTS"
wait_for_kvm () {
while true; do
if ssh -q $SSHOPTS true; then
echo "kvm ready"
break;
fi
sleep 5
done
}
# check if the system is kvm capable
if ! egrep -q '(vmx|svm)' /proc/cpuinfo; then
echo "Your hardware does not support the cpu extenstions required to run kvm"
echo "Checkout https://wiki.ubuntu.com/kvm for more information"
exit 1
fi
# kill the $SSHHOSTS to avoid the REMOTE HOST IDENTIFICATION HAS CHANGED!
# warning
rm -vf $SSHHOSTS
# create ssh keys (if needed)
if [ ! -f $SSHKEY ]; then
ssh-keygen -N '' -f $SSHKEY
fi
# clone the system and make it ssh accessable
echo "Cloning system"
if [ -d "vm-auto-upgrade-test" ]; then
echo "Using the existing cloned system to perform a upgrade test"
echo "If that is not what you want, please press ctrl-c now to"
echo "abort the test."
else
sandbox-clone-to-vm -d vm-auto-upgrade-test --ssh-key ${SSHKEY}.pub
fi
# start it in the background
echo "Starting kvm (with vnc on $VNCPORT)"
kvm $KVMOPTS vm-auto-upgrade-test/root.qcow2 &
# now ssh into it and run a release upgrade (the kvm reboot and therefore
# stops kvm after the upgrade)
wait_for_kvm
echo "Running test upgrade in kvm"
if ! ssh $SSHOPTS -- do-release-upgrade -d -f DistUpgradeViewNonInteractive; then
echo "do-release-upgrade failed with exit code $?"
else
echo "do-releae-upgrade success: $?"
fi
echo "now copying the results to $RESULTDIR"
scp $SCPOPTS root@localhost:/var/log/dist-upgrade/* $RESULTDIR
# and stop the virtual machine
ssh $SSHOPTS -- /sbin/halt
echo "You may want to view $RESULTDIR/main.log for a overview"
|