/usr/share/autopkgtest/xenlvm/setup is in autopkgtest-xenlvm 2.0.1ubuntu4.
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 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | #!/bin/bash
set -e
adt_readconfig_needkernel=y
adt_readconfig_needlock=y
. ${ADT_XENLVM_SHARE:=/usr/share/autopkgtest/xenlvm}/readconfig
test $nonoptargs = 0 || fail "non-option arguments not allowed"
$ADT_XENLVM_SHARE/purge "$@"
#----- create fs base
lvm_create_base () {
xl lvcreate -L $3 -n $2 $1 $4
xl lvcreate -L $6 -n $5 $1 $7
if $8; then
basesize=`lvdisplay -c $9 8>&- 3>&-`
basesize="${basesize#*:*:*:*:*:*:}"
basesize="${basesize%%:*}"
x dd if=/dev/zero of=$9 bs=512 count="$basesize"
fi
}
lvm_create_base $adt_lvm_vg \
$adt_lvm_baselv $adt_fs_size $adt_lvm_pv_fsbase \
$adt_lvm_cowdatalv $adt_fs_snapsize $adt_lvm_pv_fssnap \
$adt_lvm_erasebase $lvm_baselv_namepath
x mkfs -t $adt_fs_type $adt_mkfs_args $lvm_baselv_namepath
#----- create swap base
if $provide_swap; then
lvm_create_base $adt_lvm_swapvg \
$adt_lvm_swapbaselv $adt_swap_size $adt_lvm_pv_swapbase \
$adt_lvm_swapcowdatalv $adt_swap_snapsize $adt_lvm_pv_swapsnap \
$adt_lvm_eraseswap $lvm_baselv_swapnamepath
x mkswap $lvm_baselv_swapnamepath
swapdisk=", \"phy:$lvm_swaplink_ptrrhs,hda2,w\""
fi
#----- create base filesystem and info
mkdir -p $adt_play/base
x mount $lvm_baselv_namepath $adt_play/base
x debootstrap \
--components="${adt_debootstrap_components}" \
--include=${adt_debootstrap_include},${adt_debootstrap_includemore} \
$adt_debootstrap_opts \
"$adt_distro" "$adt_play/base" \
"$adt_debootstrap_mirrors" "$adt_debootstrap_script" \
|perl -pe '
s/^(I: (?:Retrieving|Validating|Extracting|Unpacking|Configuring) [^A-Z].*)\n/
sprintf "%-75s\r", $1
/e
'
$ADT_XENLVM_SHARE/fixups "$@"
echo "
--- writing $adt_xmconfig ---
"
cat <<END >$adt_xmconfig
kernel = "$adt_kernel"
memory = $adt_testbed_ram
root = "/dev/hda1"
extra = "ro console=tty0 $adt_xmhook_extra"
disk = [ "phy:$lvm_fslink_ptrrhs,hda1,w"$swapdisk $adt_xmhook_disk ]
vif = [ "bridge=none,mac=$adt_guest_macaddr,ip=${adt_guest_ipaddr},script=${adt_net_vifscript}" $adt_xmhook_vif ]
on_crash = "preserve"
on_reboot = "preserve"
on_shutdown = "preserve"
$adt_xmhook_config
END
if [ "x$adt_ramdisk" != x ]; then
cat <<END >>$adt_xmconfig
ramdisk = "$adt_ramdisk"
END
fi
if [ "x$adt_setup_hook" != x ]; then
$adt_setup_hook ${adt_play}/base
fi
x umount $lvm_baselv_namepath
for fs in fs swap; do
swap=${fs#fs}; eval "
mkdir -p \${lvm_${fs}link_dirpath}
ln -sf ../\$lvm_baselv_${swap}namerhs \${lvm_${fs}link_ptr}
"
done
x xm create $adt_xmconfig name=$adt_xmname
retries=10
if grep 0 /proc/sys/net/ipv4/ip_forward >/dev/null; then
cat <<END
********** WARNING - IP FORWARDING IS TURNED OFF ON THE HOST **********
Your testbed will probably have trouble with downloads, DNS, etc.
You must turn this on manually, since it is a major config change.
END
fi
while true; do
if ping -c 1 $adt_guest_ipaddr && \
/usr/share/autopkgtest/xenlvm/on-testbed "$@" '
set -e; umask 002; cd /var/lib;
mkdir -p autopkgtest; cd autopkgtest;
touch xenlvm-created
'; then break; fi
if [ $retries -le 0 ]; then
echo >&2 'no response from guest'
x xm console $adt_xmname
exit 1
fi
retries=$(($retries-1))
sleep 2
done
x xm mem-set $adt_xmname $adt_freeze_ram
retries=$adt_vm_reduce_retries
while sleep 1; do
if x xm mem-max $adt_xmname $adt_freeze_ram; then break; fi
if [ $retries -le 0 ]; then echo >&2 'cannot reduce memory'; exit 1; fi
retries=$(($retries-1))
done
x xm save $adt_xmname $adt_play/xen-save
rm ${lvm_fslink_ptr} ${lvm_swaplink_ptr}
touch "$adt_play/good"
|