chiark / gitweb /
WIP userv service and print-execute-command
[autopkgtest.git] / xen / userv-target
1 #!/bin/bash
2 set -e
3 fail () { printf >&2 "%s: %s\n" "$0" "$*"; exit 127; }
4
5 . /etc/lsb-release
6
7 d="${USERV_U_distro-$DISTRIB_CODENAME}"
8 n="${USERV_U_nominum-adt}"
9
10 case "$dn" in
11 */*|.*|*.*|*_*_*)       fail 'dangerous format in distro or nominum'    ;;
12 adt*)   ;;
13 *)      fail 'userv adtxenlvm only supports nominums starting with adt' ;;
14 esac
15
16 test -d /var/lib/autopkgtest/xenlvm/"$dn" || fail 'unknown distro or nominum'
17
18 run () {
19         base="$1"; shift
20         exec "$base" --adt-distro="$d" --adt-nominum="$n" "$@"
21 }
22
23 case "$1" in
24 with)   run adt-xenlvm-with-testbed sh -c 'echo y && exec cat' ;;
25 pon0)   run adt-xenlvm-on-testbed -- --print0-command ;;
26 *)      fail 'unknown mode'
27 esac