autopkgtest (0.9.0~iwj) unstable; urgency=low
- * WIP userv service.
+ * WIP userv service use by adt-virt-xenlvm.
+ * userv service for testbed invocation now provided and
+ at least somewhat tested.
* New print-execute-command command for virtualisation servers.
* Do not demand vg or distro information for initscript to work.
* autopkgtest-xenlvm now Recommends: lvm2 and debootstrap.
to create new testbeds.
To make this feature available:
- * Install userv
+ * Install userv.
* Create a group named AdtXenUs containing the users which should
- be able to manipulate and use the testbed. (This group can start
- out empty but should exist before setting up the testbed for
- the first time.)
- *
+ be able to manipulate and use the testbed.
+ * Run adt-xenlvm-setup. NB that the group can be empty at this
+ point but should exist before setting up the testbed, or the
+ testbed setup will not be correct.
-The configuration as supplied does not make it
+Typically adt-xenlvm-setup ought to be run periodically anyway to
+make sure that the snapshot doesn't get too out of date.
+
+
+Client interface
+----------------
+
+The service is as invoked as
+ userv [-Ddistro=<distro> -Dnominum=<nominum>] root adt-xenlvm-testbed <act>
+where <act> is either
+ with
+ Starts adt-xenlvm-with-testbed, prints `y', waits for
+ eof on stdin, and then exits adt-xenlvm-with-testbed.
+ pon0
+ Prints the command that ought to be run to execute
+ commands on the testbed. The output is a command and
+ arguments, each followed by a null byte. These should
+ be put into an array of strings and passed to exec,
+ with the actual command to be run added as a final
+ argument (in sh syntax).
. ${ADT_XENLVM_SHARE:=/usr/share/autopkgtest/xenlvm}/justconfig
while test $# -gt $nonoptargs; do shift; done
+: "$1"
+
case "$1" in
-x--print-command) ppfx=echo; shift ;;
-x--print0-command) ppfx=ppfx0; shift ;;
-x--) shift ;;
-x-*) fail "invalid instead-of-command options \`$1'" ;;
+--print-command) ppfx=echo; shift ;;
+--print0-command) ppfx=ppfx0; shift ;;
+--) shift ;;
+-*) fail "invalid instead-of-command options \`$1'" ;;
esac
ppfx0 () { for x in "$@"; do printf '%s\0' "$x"; done; }
set -e
fail () { printf >&2 "%s: %s\n" "$0" "$*"; exit 127; }
-. /etc/lsb-release
+if test -f /etc/lsb-release; then . /etc/lsb-release; fi
-d="${USERV_U_distro-$DISTRIB_CODENAME}"
-n="${USERV_U_nominum-adt}"
+d="${USERV_U_distro:-$DISTRIB_CODENAME}"
+n="${USERV_U_nominum:-adt}"
-case "$dn" in
+nd="${n}_${d}"
+
+case "$nd" in
*/*|.*|*.*|*_*_*) fail 'dangerous format in distro or nominum' ;;
adt*) ;;
*) fail 'userv adtxenlvm only supports nominums starting with adt' ;;
esac
-dndir=/var/lib/autopkgtest/xenlvm/"$dn"
-test -d "$dndir" || fail 'unknown distro or nominum'
+nddir=/var/lib/autopkgtest/xenlvm/"$nd"
+test -d "$nddir" || fail 'unknown distro or nominum'
run () {
base="$1"; shift
}
case "$1" in
-with) adt-xenlvm-with-testbed sh -c 'echo y && exec cat' ;;
+with) run adt-xenlvm-with-testbed sh -c 'echo y && exec cat' ;;
pon0) run adt-xenlvm-on-testbed -- --print0-command ;;
*) fail 'unknown mode'
esac