From: Ian Jackson Date: Fri, 29 Jun 2007 17:23:16 +0000 (+0100) Subject: * export adt_* variable settings resulting from command-line X-Git-Tag: converted-from-bzr~46^2~13 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=30f4d2446ddf603cde4881f37f065cd4efdbf2b2;p=autopkgtest.git * export adt_* variable settings resulting from command-line arguments so that subprocesses get them properly, and arrange for the `defaults for simple settings' not to override environment variables. * suppress various variable settings' default computations (and consequent failure if the default can't be established) when processing config for the initscript. The initscript does not need per-testbed configuration options. * close fd 8 when running vgdisplay (which avoids an annoying and spurious warning from the lvm tools). --- diff --git a/debian/changelog b/debian/changelog index e2b69cb..7e60fef 100644 --- a/debian/changelog +++ b/debian/changelog @@ -10,6 +10,16 @@ autopkgtest (0.9.0~iwj) unstable; urgency=low * Check for udev persistent-net-generator and if enabled we write a rune for eth0 for guest_macaddr into the RULES_FILE specified in /lib/udev/write_net_rules. + * export adt_* variable settings resulting from command-line + arguments so that subprocesses get them properly, and arrange + for the `defaults for simple settings' not to override environment + variables. + * suppress various variable settings' default computations (and + consequent failure if the default can't be established) when + processing config for the initscript. The initscript does not + need per-testbed configuration options. + * close fd 8 when running vgdisplay (which avoids an annoying and + spurious warning from the lvm tools). -- diff --git a/xen/initscript b/xen/initscript index 682e74b..373d265 100755 --- a/xen/initscript +++ b/xen/initscript @@ -82,6 +82,7 @@ case "$VERBOSE" in no) exec >/dev/null ;; esac +adt_readconfig_initscript=y printf "adtxenlvm: reading configuration for firewall setup:\n" . ${ADT_XENLVM_SHARE:=/usr/share/autopkgtest/xenlvm}/readconfig diff --git a/xen/readconfig.in b/xen/readconfig.in index cbd3e85..a30c1ca 100644 --- a/xen/readconfig.in +++ b/xen/readconfig.in @@ -20,31 +20,31 @@ esac #---------- default values for simple settings ---------- -adt_nominum=adt -adt_testbed_ram=256 -adt_freeze_ram=32 -adt_fs_size=3072M -adt_fs_snapsize=2560M -adt_fs_cowchunk=8 -adt_playbase=/var/lib/autopkgtest/xenlvm -adt_fs_type=ext3 -adt_fs_mkfs_args='' -adt_vm_reduce_retries=10 -adt_ssh_keytype=dsa - -adt_debootstrap_components='*' -adt_debootstrap_include=libc6-xen,openssh-server,ed -adt_debootstrap_includemore= -adt_debootstrap_mirrors='' -adt_debootstrap_script='' - -adt_fw_localmirrors='' -adt_fw_prohibnets='192.168.0.0/24 172.16.0.0/12 10.0.0.0/8' -adt_fw_allowglobalports='80' - -adt_guest_macaddr=00:16:3e:7c:aa:7f -adt_net_vifscript=/etc/xen/scripts/vif-route-adt -adt_normaluser=adtxenu +: ${adt_nominum:=adt} +: ${adt_testbed_ram:=256} +: ${adt_freeze_ram:=32} +: ${adt_fs_size:=3072M} +: ${adt_fs_snapsize:=2560M} +: ${adt_fs_cowchunk:=8} +: ${adt_playbase:=/var/lib/autopkgtest/xenlvm} +: ${adt_fs_type:=ext3} +: ${adt_fs_mkfs_args:=} +: ${adt_vm_reduce_retries:=10} +: ${adt_ssh_keytype:=dsa} + +: ${adt_debootstrap_components:='*'} +: ${adt_debootstrap_include:=libc6-xen,openssh-server,ed} +: ${adt_debootstrap_includemore:=} +: ${adt_debootstrap_mirrors:=} +: ${adt_debootstrap_script:=} + +: ${adt_fw_localmirrors:=} +: ${adt_fw_prohibnets:=192.168.0.0/24 172.16.0.0/12 10.0.0.0/8} +: ${adt_fw_allowglobalports:=80} + +: ${adt_guest_macaddr:=00:16:3e:7c:aa:7f} +: ${adt_net_vifscript:=/etc/xen/scripts/vif-route-adt} +: ${adt_normaluser:=adtxenu} #---------- arguments and config file ---------- @@ -67,7 +67,7 @@ cmdline_args () { *) fail "unknown configuration variable \`$var'" ;; esac - eval "adt_$var=\"\$value\"" + eval "adt_$var=\"\$value\"; export adt_$var" shift ;; --) shift; break ;; @@ -85,14 +85,15 @@ cmdline_args "$@" #---------- calculated defaults for complex settings ---------- -case "$adt_lvm_vg" in -'') +if [ ! "${adt_readconfig_initscript}" ]; then + case "$adt_lvm_vg" in + '') printf "searching for default volume group ... " - vgdisplay_out=`vgdisplay -c 10>&-` + vgdisplay_out=`vgdisplay -c 8>&-` case "$vgdisplay_out" in "") fail 'no volume groups found';; *" -"*) fail 'several volume groups, config must specify which';; + "*) fail 'several volume groups, config must specify which';; esac adt_lvm_vg=${vgdisplay_out%%:*} case "$adt_lvm_vg" in @@ -101,7 +102,8 @@ case "$adt_lvm_vg" in adt_lvm_vg=${adt_lvm_vg##* } echo "using system's only volume group: $adt_lvm_vg" ;; -esac + esac +fi if [ "$adt_readconfig_needkernel" ]; then case "$adt_kernel" in @@ -156,8 +158,9 @@ case "$adt_modules" in *) ;; esac -case "$adt_distro" in -'') +if [ ! "${adt_readconfig_initscript}" ]; then + case "$adt_distro" in + '') printf "considering which distro to use ... " test -e /etc/lsb-release || \ fail 'no /etc/lsb-version, config must specify adt_distro' @@ -165,7 +168,8 @@ case "$adt_distro" in adt_distro=$DISTRIB_CODENAME echo "using same distro as host: $adt_distro" ;; -esac + esac +fi hostname_from_ipaddr () { eval ' @@ -178,16 +182,20 @@ hostname_from_ipaddr () { ' } -hostname_from_ipaddr guest hostname_from_ipaddr host +if [ ! "${adt_readconfig_initscript}" ]; then + hostname_from_ipaddr guest +fi + if [ x"$adt_host_hostname" = x ]; then printf "finding host hostname, supposely our own FQDN: " adt_host_hostname=`hostname -f` printf "%s\n" "$adt_host_hostname" fi -if [ x"$adt_guest_hostname" = x ]; then +if [ ! "${adt_readconfig_initscript}" ]; then + if [ x"$adt_guest_hostname" = x ]; then case "$adt_guests_domain" in '') printf "guessing guest hostname from host hostname: " adt_guest_hostname=$adt_distro.$adt_nominum.${adt_host_hostname#*.} ;; @@ -197,6 +205,7 @@ if [ x"$adt_guest_hostname" = x ]; then adt_guest_hostname=$adt_distro.$adt_guests_domain ;; esac printf "%s\n" "$adt_guest_hostname" + fi fi ipaddr_from_hostname () { @@ -210,8 +219,10 @@ ipaddr_from_hostname () { ' } -ipaddr_from_hostname guest ipaddr_from_hostname host +if [ ! "${adt_readconfig_initscript}" ]; then + ipaddr_from_hostname guest +fi search_hook () { eval '