/usr/share/autopkgtest/ssh-setup/SKELETON is in autopkgtest 5.3.1.
This file is owned by root:root, with mode 0o644.
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 | #!/bin/sh
# Skeleton for an autopkgtest-virt-ssh setup script that configures a testbed.
# See man autopkgtest-virt-ssh for details.
set -e
# add testbed capabilities here (possibly dynamically), see
# doc/README.virtualisation-server.rst
CAPABILITIES='isolation-machine'
SUDO_PASSWORD=''
# create a testbed (if necessary), configure ssh, copy ssh key into it,
# configure sudo, etc.; print a list of "key=value" parameters to stdout on
# success
# required: login, hostname
# optional: identity, password, port, options, capabilities, extraopts
# see autopkgtest-virt-ssh(1) for details
open() {
cat<<EOF
login=<username>
hostname=<host>
capabilities=$CAPABILITIES
identity=$HOME/.ssh/id_rsa
extraopts="<additional args to pass to the script with other commands>"
EOF
if [ -n "$SUDO_PASSWORD" ]; then
echo "password=$SUDO_PASSWORD"
fi
}
# called when closing the testbed; should revert/remove things installed in
# open() if the testbed is not ephemeral
cleanup() {
exit 0
}
# Called for reverting the testbed. This can optionally output some or all of
# the ssh config keys from open() to update the configuration.
# This only needs to be implemented if CAPABILITIES offers "revert".
revert() {
echo "revert not implemented" >&2
exit 1
# calling these two is a common method, but there might be a more efficient
# way like snapshots
# cleanup
# open
}
# Called after "reboot". You only need to implement this if CAPABILITIES offers
# "reboot" and you need to do something more elaborate than just waiting for
# ssh to go down and come back.
wait_reboot() {
# wait for testbed to shut down, come back up, and re-prepare for ssh login
exit 1 # not implemented
}
# Called when the setup script fails with nonzero or on timeouts waiting for
# ssh or reboot. If available, this should output some debugging information,
# such as the boot log from the serial console. Implementing this is optional.
debug_failure() {
exit 1 # not implemented
}
case "$1" in
open)
open $@;;
cleanup)
cleanup $@;;
revert)
revert $@;;
wait-reboot)
wait_reboot $@;;
debug-failure)
debug_failure $@;;
'')
echo "Needs to be called with command as first argument" >&2
exit 1
;;
*)
echo "invalid command $1" >&2
exit 1
;;
esac
|