chiark / gitweb /
* export adt_* variable settings resulting from command-line
authorIan Jackson <ian@davenant.greenend.org.uk>
Fri, 29 Jun 2007 17:23:16 +0000 (18:23 +0100)
committerIan Jackson <ian@davenant.greenend.org.uk>
Fri, 29 Jun 2007 17:23:16 +0000 (18:23 +0100)
  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).

debian/changelog
xen/initscript
xen/readconfig.in

index e2b69cb74ccbae8f7a4a35cab57fc5771c4bf0f7..7e60fefc2c489057a24b8b336dfac74ec6c0a214 100644 (file)
@@ -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).
 
  --
 
index 682e74b24d75403ca4b9569beba07962d0abc6eb..373d265ea7eff1d33efa4c8194e064efd180d4f0 100755 (executable)
@@ -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
 
index cbd3e85be4a6a6c02a9493e18667a3413dfac9b8..a30c1cabf36eda21a5164f3f61c934a1f038e3f6 100644 (file)
@@ -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 '